<?xml version='1.0' encoding='UTF-8'?>
<!DOCTYPE html PUBLIC '-//W3C//DTD XHTML 1.0 Transitional//EN' 'http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd'>
<html dir="ltr" xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>The JSON-LD API 1.0</title>
<meta content="text/html; charset=UTF-8" http-equiv="content-type" />

<!--
  === NOTA BENE ===
  For the three scripts below, if your spec resides on dev.w3 you can check them
  out in the same tree and use relative links so that they'll work offline,
   -->



<style>
.diff { font-weight:bold; color:#0a3; }
ol.algorithm.update { margin-left: 2em; }
ol.algorithm.update>li { list-style-type: none; }
ol.algorithm.update>li>span.list-number {
  display:block;
  float: left;
  margin-left: -3.5em;
}
</style>
<style type="text/css">
/*****************************************************************
 * ReSpec CSS
 * Robin Berjon (robin at berjon dot com)
 * v0.05 - 2009-07-31
 *****************************************************************/


/* --- INLINES --- */
em.rfc2119 {
    text-transform:     lowercase;
    font-variant:       small-caps;
    font-style:         normal;
    color:              #900;
}

h1 acronym, h2 acronym, h3 acronym, h4 acronym, h5 acronym, h6 acronym, a acronym,
h1 abbr, h2 abbr, h3 abbr, h4 abbr, h5 abbr, h6 abbr, a abbr {
    border: none;
}

dfn {
    font-weight:    bold;
}

a.internalDFN {
    color:  inherit;
    border-bottom:  1px solid #99c;
    text-decoration:    none;
}

a.externalDFN {
    color:  inherit;
    border-bottom:  1px dotted #ccc;
    text-decoration:    none;
}

a.bibref {
    text-decoration:    none;
}

code {
    color:  #ff4500;
}


/* --- WEB IDL --- */
pre.idl {
    border-top: 1px solid #90b8de;
    border-bottom: 1px solid #90b8de;
    padding:    1em;
    line-height:    120%;
}

pre.idl::before {
    content:    "WebIDL";
    display:    block;
    width:      150px;
    background: #90b8de;
    color:  #fff;
    font-family:    initial;
    padding:    3px;
    font-weight:    bold;
    margin: -1em 0 1em -1em;
}

.idlType {
    color:  #ff4500;
    font-weight:    bold;
    text-decoration:    none;
}

/*.idlModule*/
/*.idlModuleID*/
/*.idlInterface*/
.idlInterfaceID, .idlDictionaryID {
    font-weight:    bold;
    color:  #005a9c;
}

.idlSuperclass {
    font-style: italic;
    color:  #005a9c;
}

/*.idlAttribute*/
.idlAttrType, .idlFieldType, .idlMemberType {
    color:  #005a9c;
}
.idlAttrName, .idlFieldName, .idlMemberName {
    color:  #ff4500;
}
.idlAttrName a, .idlFieldName a, .idlMemberName a {
    color:  #ff4500;
    border-bottom:  1px dotted #ff4500;
    text-decoration: none;
}

/*.idlMethod*/
.idlMethType {
    color:  #005a9c;
}
.idlMethName {
    color:  #ff4500;
}
.idlMethName a {
    color:  #ff4500;
    border-bottom:  1px dotted #ff4500;
    text-decoration: none;
}

/*.idlParam*/
.idlParamType {
    color:  #005a9c;
}
.idlParamName {
    font-style: italic;
}

.extAttr {
    color:  #666;
}

/*.idlConst*/
.idlConstType {
    color:  #005a9c;
}
.idlConstName {
    color:  #ff4500;
}
.idlConstName a {
    color:  #ff4500;
    border-bottom:  1px dotted #ff4500;
    text-decoration: none;
}

/*.idlException*/
.idlExceptionID {
    font-weight:    bold;
    color:  #c00;
}

.idlTypedefID, .idlTypedefType {
    color:  #005a9c;
}

.idlRaises, .idlRaises a.idlType, .idlRaises a.idlType code, .excName a, .excName a code {
    color:  #c00;
    font-weight:    normal;
}

.excName a {
    font-family:    monospace;
}

.idlRaises a.idlType, .excName a.idlType {
    border-bottom:  1px dotted #c00;
}

.excGetSetTrue, .excGetSetFalse, .prmNullTrue, .prmNullFalse, .prmOptTrue, .prmOptFalse {
    width:  45px;
    text-align: center;
}
.excGetSetTrue, .prmNullTrue, .prmOptTrue { color:  #0c0; }
.excGetSetFalse, .prmNullFalse, .prmOptFalse { color:  #c00; }

.idlImplements a {
    font-weight:    bold;
}

dl.attributes, dl.methods, dl.constants, dl.fields, dl.dictionary-members {
    margin-left:    2em;
}

.attributes dt, .methods dt, .constants dt, .fields dt, .dictionary-members dt {
    font-weight:    normal;
}

.attributes dt code, .methods dt code, .constants dt code, .fields dt code, .dictionary-members dt code {
    font-weight:    bold;
    color:  #000;
    font-family:    monospace;
}

.attributes dt code, .fields dt code, .dictionary-members dt code {
    background:  #ffffd2;
}

.attributes dt .idlAttrType code, .fields dt .idlFieldType code, .dictionary-members dt .idlMemberType code {
    color:  #005a9c;
    background:  transparent;
    font-family:    inherit;
    font-weight:    normal;
    font-style: italic;
}

.methods dt code {
    background:  #d9e6f8;
}

.constants dt code {
    background:  #ddffd2;
}

.attributes dd, .methods dd, .constants dd, .fields dd, .dictionary-members dd {
    margin-bottom:  1em;
}

table.parameters, table.exceptions {
    border-spacing: 0;
    border-collapse:    collapse;
    margin: 0.5em 0;
    width:  100%;
}
table.parameters { border-bottom:  1px solid #90b8de; }
table.exceptions { border-bottom:  1px solid #deb890; }

.parameters th, .exceptions th {
    color:  #fff;
    padding:    3px 5px;
    text-align: left;
    font-family:    initial;
    font-weight:    normal;
    text-shadow:    #666 1px 1px 0;
}
.parameters th { background: #90b8de; }
.exceptions th { background: #deb890; }

.parameters td, .exceptions td {
    padding:    3px 10px;
    border-top: 1px solid #ddd;
    vertical-align: top;
}

.parameters tr:first-child td, .exceptions tr:first-child td {
    border-top: none;
}

.parameters td.prmName, .exceptions td.excName, .exceptions td.excCodeName {
    width:  100px;
}

.parameters td.prmType {
    width:  120px;
}

table.exceptions table {
    border-spacing: 0;
    border-collapse:    collapse;
    width:  100%;
}

/* --- TOC --- */
.toc a {
    text-decoration:    none;
}

a .secno {
    color:  #000;
}

/* --- TABLE --- */
table.simple {
    border-spacing: 0;
    border-collapse:    collapse;
    border-bottom:  3px solid #005a9c;
}

.simple th {
    background: #005a9c;
    color:  #fff;
    padding:    3px 5px;
    text-align: left;
}

.simple th[scope="row"] {
    background: inherit;
    color:  inherit;
    border-top: 1px solid #ddd;
}

.simple td {
    padding:    3px 10px;
    border-top: 1px solid #ddd;
}

.simple tr:nth-child(even) {
    background: #f0f6ff;
}

/* --- DL --- */
.section dd > p:first-child {
    margin-top: 0;
}

.section dd > p:last-child {
    margin-bottom: 0;
}

.section dd {
    margin-bottom:  1em;
}

.section dl.attrs dd, .section dl.eldef dd {
    margin-bottom:  0;
}

/* --- EXAMPLES --- */
pre.example {
    border-top: 1px solid #ff4500;
    border-bottom: 1px solid #ff4500;
    padding:    1em;
    margin-top: 1em;
}

pre.example::before {
    content:    "Example";
    display:    block;
    width:      150px;
    background: #ff4500;
    color:  #fff;
    font-family:    initial;
    padding:    3px;
    font-weight:    bold;
    margin: -1em 0 1em -1em;
}

/* --- EDITORIAL NOTES --- */
.issue {
    padding:    1em;
    margin: 1em 0em 0em;
    border: 1px solid #f00;
    background: #ffc;
}

.issue::before {
    content:    "Issue";
    display:    block;
    width:  150px;
    margin: -1.5em 0 0.5em 0;
    font-weight:    bold;
    border: 1px solid #f00;
    background: #fff;
    padding:    3px 1em;
}

.note {
    margin: 1em 0em 0em;
    padding:    1em;
    border: 2px solid #cff6d9;
    background: #e2fff0;
}

.note::before {
    content:    "Note";
    display:    block;
    width:  150px;
    margin: -1.5em 0 0.5em 0;
    font-weight:    bold;
    border: 1px solid #cff6d9;
    background: #fff;
    padding:    3px 1em;
}

/* --- Best Practices --- */
div.practice {
    border: solid #bebebe 1px;
    margin: 2em 1em 1em 2em;
}

span.practicelab {
    margin: 1.5em 0.5em 1em 1em;
    font-weight: bold;
    font-style: italic;
}

span.practicelab   { background: #dfffff; }

span.practicelab {
    position: relative;
    padding: 0 0.5em;
    top: -1.5em;
}

p.practicedesc {
    margin: 1.5em 0.5em 1em 1em;
}

@media screen {
    p.practicedesc {
        position: relative;
        top: -2em;
        padding: 0;
        margin: 1.5em 0.5em -1em 1em;
    }
}

/* --- SYNTAX HIGHLIGHTING --- */
pre.sh_sourceCode {
  background-color: white;
  color: black;
  font-style: normal;
  font-weight: normal;
}

pre.sh_sourceCode .sh_keyword { color: #005a9c; font-weight: bold; }           /* language keywords */
pre.sh_sourceCode .sh_type { color: #666; }                            /* basic types */
pre.sh_sourceCode .sh_usertype { color: teal; }                             /* user defined types */
pre.sh_sourceCode .sh_string { color: red; font-family: monospace; }        /* strings and chars */
pre.sh_sourceCode .sh_regexp { color: orange; font-family: monospace; }     /* regular expressions */
pre.sh_sourceCode .sh_specialchar { color: 	#ffc0cb; font-family: monospace; }  /* e.g., \n, \t, \\ */
pre.sh_sourceCode .sh_comment { color: #A52A2A; font-style: italic; }         /* comments */
pre.sh_sourceCode .sh_number { color: purple; }                             /* literal numbers */
pre.sh_sourceCode .sh_preproc { color: #00008B; font-weight: bold; }       /* e.g., #include, import */
pre.sh_sourceCode .sh_symbol { color: blue; }                            /* e.g., *, + */
pre.sh_sourceCode .sh_function { color: black; font-weight: bold; }         /* function calls and declarations */
pre.sh_sourceCode .sh_cbracket { color: red; }                              /* block brackets (e.g., {, }) */
pre.sh_sourceCode .sh_todo { font-weight: bold; background-color: #00FFFF; }   /* TODO and FIXME */

/* Predefined variables and functions (for instance glsl) */
pre.sh_sourceCode .sh_predef_var { color: #00008B; }
pre.sh_sourceCode .sh_predef_func { color: #00008B; font-weight: bold; }

/* for OOP */
pre.sh_sourceCode .sh_classname { color: teal; }

/* line numbers (not yet implemented) */
pre.sh_sourceCode .sh_linenum { display: none; }

/* Internet related */
pre.sh_sourceCode .sh_url { color: blue; text-decoration: underline; font-family: monospace; }

/* for ChangeLog and Log files */
pre.sh_sourceCode .sh_date { color: blue; font-weight: bold; }
pre.sh_sourceCode .sh_time, pre.sh_sourceCode .sh_file { color: #00008B; font-weight: bold; }
pre.sh_sourceCode .sh_ip, pre.sh_sourceCode .sh_name { color: #006400; }

/* for Prolog, Perl... */
pre.sh_sourceCode .sh_variable { color: #006400; }

/* for LaTeX */
pre.sh_sourceCode .sh_italics { color: #006400; font-style: italic; }
pre.sh_sourceCode .sh_bold { color: #006400; font-weight: bold; }
pre.sh_sourceCode .sh_underline { color: #006400; text-decoration: underline; }
pre.sh_sourceCode .sh_fixed { color: green; font-family: monospace; }
pre.sh_sourceCode .sh_argument { color: #006400; }
pre.sh_sourceCode .sh_optionalargument { color: purple; }
pre.sh_sourceCode .sh_math { color: orange; }
pre.sh_sourceCode .sh_bibtex { color: blue; }

/* for diffs */
pre.sh_sourceCode .sh_oldfile { color: orange; }
pre.sh_sourceCode .sh_newfile { color: #006400; }
pre.sh_sourceCode .sh_difflines { color: blue; }

/* for css */
pre.sh_sourceCode .sh_selector { color: purple; }
pre.sh_sourceCode .sh_property { color: blue; }
pre.sh_sourceCode .sh_value { color: #006400; font-style: italic; }

/* other */
pre.sh_sourceCode .sh_section { color: black; font-weight: bold; }
pre.sh_sourceCode .sh_paren { color: red; }
pre.sh_sourceCode .sh_attribute { color: #006400; }

</style><style type="text/css">ol.algorithm { counter-reset:numsection; list-style-type: none; }
ol.algorithm li { margin: 0.5em 0; }
ol.algorithm li:before { font-weight: bold; counter-increment: numsection; content: counters(numsection, ".") ") "; }

<style type='text/css'>
.diff-old-a {
  font-size: smaller;
  color: red;
}

.diff-new { background-color: yellow; }
.diff-chg { background-color: lime; }
.diff-new:before,
.diff-new:after
    { content: "\2191" }
.diff-chg:before, .diff-chg:after
    { content: "\2195" }
.diff-old { text-decoration: line-through; background-color: #FBB; }
.diff-old:before,
.diff-old:after
    { content: "\2193" }
:focus { border: thin red solid}
</style>
</style><link href="http://www.w3.org/StyleSheets/TR/w3c-unofficial" rel="stylesheet" type="text/css" charset="utf-8" /></head>

<body style="display: inherit;"><div class="head"><p></p><h1 id="title" class="title">The JSON-LD API 1.0</h1><h2 id="subtitle">An Application Programming Interface for the JSON-LD Syntax</h2><h2 id="unofficial-draft-26-april-2012">Unofficial Draft 26 April 2012</h2><dl><dt>Editors:</dt><dd><a href="http://manu.sporny.org/">Manu Sporny</a>, <a href="http://digitalbazaar.com/">Digital Bazaar</a></dd>
<dd>
<a href="http://greggkellogg.net/">
Gregg
Kellogg
</a>,
<a href="http://kellogg-assoc.com/">
Kellogg
Associates
</a>
</dd>
<dd>
<a href="http://digitalbazaar.com/">
Dave
Longley
</a>,
<a href="http://digitalbazaar.com/">
Digital
Bazaar
</a>
</dd>
<dd>
<a href="http://www.markus-lanthaler.com/">
<ins class="diff-new">Markus
Lanthaler
</ins></a>,<a href="http://www.tugraz.at/"><ins class="diff-new">
Graz
University
of
Technology
</ins></a></dd>
<dt>
Authors:
</dt>
<dd>
<a href="http://digitalbazaar.com/">
Dave
Longley
</a>,
<a href="http://digitalbazaar.com/">
Digital
Bazaar
</a>
</dd>
<dd>
<a href="http://digitalbazaar.com/">
Manu
Sporny
</a>,
<a href="http://digitalbazaar.com/">
Digital
Bazaar
</a>
</dd>
<dd>
<a href="http://greggkellogg.net/">
Gregg
Kellogg
</a>,
<a href="http://kellogg-assoc.com/">
Kellogg
Associates
</a>
</dd>
<dd>
<a href="http://www.markus-lanthaler.com/">
<ins class="diff-new">Markus
Lanthaler
</ins></a>,<a href="http://www.tugraz.at/"><ins class="diff-new">
Graz
University
of
Technology
</ins></a></dd>
</dl>
<p>
This
document
is
also
available
in
this
non-normative
format:
<a href="diff-20120112.html">
diff
to
previous
version
</a>.
</p>
<p class="copyright">
This
document
is
licensed
under
a
<a rel="license" href="http://creativecommons.org/licenses/by/3.0/" class="subfoot">
Creative
Commons
Attribution
3.0
License
</a>.
</p>
<hr />
</div>
<div id="abstract" class="introductory section">
<h2>
Abstract
</h2>
<p>
JSON
[
<cite>
<a class="bibref" rel="biblioentry" href="#bib-RFC4627">
RFC4627
</a>
</cite>
]
has
proven
to
be
a
highly
useful
object
serialization
and
messaging
format.
JSON-LD
[
<cite>
<a class="bibref" rel="biblioentry" href="#bib-JSON-LD">
JSON-LD
</a>
</cite>
]
harmonizes
the
representation
of
Linked
Data
in
JSON
by
outlining
a
common
JSON
representation
format
for
expressing
directed
graphs;
mixing
both
Linked
Data
and
non-Linked
Data
in
a
single
document.
This
document
outlines
an
Application
Programming
Interface
and
a
set
of
algorithms
for
programmatically
transforming
JSON-LD
documents.
</p>
</div>
<div class="introductory section" id="sotd">
<h2>
Status
of
This
Document
</h2>
<p>
This
document
is
merely
a
public
working
draft
of
a
potential
specification.
It
has
no
official
standing
of
any
kind
and
does
not
represent
the
support
or
consensus
of
any
standards
organisation.
</p>
<p>
This
document
is
an
experimental
work
in
progress.
</p>
</div>
<div id="toc" class="section">
<h2 class="introductory">
Table
of
Contents
</h2>
<ul class="toc">
<li class="tocline">
<a href="#introduction" class="tocxref">
<span class="secno">
1.
</span>
Introduction
</a>
<ul class="toc">
<li class="tocline">
<a href="#how-to-read-this-document" class="tocxref">
<span class="secno">
1.1
</span>
How
to
Read
this
Document
</a>
</li>
<li class="tocline">
<a href="#linked-data" class="tocxref">
<span class="secno">
1.2
</span>
Linked
Data
</a>
</li>
<li class="tocline">
<a href="#contributing" class="tocxref">
<span class="secno">
1.3
</span>
Contributing
</a>
</li>
</ul>
</li>
<li class="tocline">
<a href="#the-application-programming-interface" class="tocxref">
<span class="secno">
2.
</span>
The
Application
Programming
Interface
</a>
<ul class="toc">
<li class="tocline">
<a href="#jsonldprocessor" class="tocxref">
<span class="secno">
2.1
</span>
JsonLdProcessor
</a>
<ul class="toc">
<li class="tocline">
<a href="#methods" class="tocxref">
<span class="secno">
2.1.1
</span>
Methods
</a>
</li>
</ul>
</li>
<li class="tocline">
<a href="#callbacks" class="tocxref">
<span class="secno">
2.2
</span>
<del class="diff-old">JsonLdTripleCallback
</del>
<ins class="diff-chg">Callbacks
</ins>
</a>
<ul class="toc">
<li class="tocline">
<a href="#jsonldcallback" class="tocxref">
<span class="secno">
2.2.1
</span>
<ins class="diff-new">JsonLdCallback
</ins></a><ul class="toc"><li class="tocline"><a href="#methods-1" class="tocxref"><span class="secno"><ins class="diff-new">
2.2.1.1
</ins></span><ins class="diff-new">
Methods
</ins></a></li></ul></li><li class="tocline"><a href="#statementcallback" class="tocxref"><span class="secno"><ins class="diff-new">
2.2.2
</ins></span><ins class="diff-new">
StatementCallback
</ins></a><ul class="toc"><li class="tocline"><a href="#methods-2" class="tocxref"><span class="secno"><ins class="diff-new">
2.2.2.1
</ins></span>
Methods
</a>
</li>
</ul>
</li>
</ul>
</li>
<li class="tocline">
<a href="#data-structures" class="tocxref">
<span class="secno">
<ins class="diff-new">2.3
</ins></span><ins class="diff-new">
Data
Structures
</ins></a><ul class="toc"><li class="tocline"><a href="#url" class="tocxref"><span class="secno"><ins class="diff-new">
2.3.1
</ins></span><ins class="diff-new">
URL
</ins></a></li><li class="tocline"><a href="#jsonldoptions" class="tocxref"><span class="secno"><ins class="diff-new">
2.3.2
</ins></span><ins class="diff-new">
JsonLdOptions
</ins></a></li><li class="tocline"><a href="#statement" class="tocxref"><span class="secno"><ins class="diff-new">
2.3.3
</ins></span><ins class="diff-new">
Statement
</ins></a><ul class="toc"><li class="tocline"><a href="#attributes" class="tocxref"><span class="secno"><ins class="diff-new">
2.3.3.1
</ins></span><ins class="diff-new">
Attributes
</ins></a></li></ul></li><li class="tocline"><a href="#node" class="tocxref"><span class="secno"><ins class="diff-new">
2.3.4
</ins></span><ins class="diff-new">
Node
</ins></a><ul class="toc"><li class="tocline"><a href="#attributes-1" class="tocxref"><span class="secno"><ins class="diff-new">
2.3.4.1
</ins></span><ins class="diff-new">
Attributes
</ins></a></li></ul></li><li class="tocline"><a href="#namednode" class="tocxref"><span class="secno"><ins class="diff-new">
2.3.5
</ins></span><ins class="diff-new">
NamedNode
</ins></a><ul class="toc"><li class="tocline"><a href="#attributes-2" class="tocxref"><span class="secno"><ins class="diff-new">
2.3.5.1
</ins></span><ins class="diff-new">
Attributes
</ins></a></li></ul></li><li class="tocline"><a href="#blank-node" class="tocxref"><span class="secno"><ins class="diff-new">
2.3.6
</ins></span><ins class="diff-new">
Blank
Node
</ins></a><ul class="toc"><li class="tocline"><a href="#attributes-3" class="tocxref"><span class="secno"><ins class="diff-new">
2.3.6.1
</ins></span><ins class="diff-new">
Attributes
</ins></a></li></ul></li><li class="tocline"><a href="#literalnode" class="tocxref"><span class="secno"><ins class="diff-new">
2.3.7
</ins></span><ins class="diff-new">
LiteralNode
</ins></a><ul class="toc"><li class="tocline"><a href="#attributes-4" class="tocxref"><span class="secno"><ins class="diff-new">
2.3.7.1
</ins></span><ins class="diff-new">
Attributes
</ins></a></li></ul></li></ul></li></ul></li><li class="tocline">
<a href="#algorithms" class="tocxref">
<span class="secno">
3.
</span>
Algorithms
</a>
<ul class="toc">
<li class="tocline">
<a href="#syntax-tokens-and-keywords" class="tocxref">
<span class="secno">
3.1
</span>
Syntax
Tokens
and
Keywords
</a>
</li>
<li class="tocline">
<a href="#algorithm-terms" class="tocxref">
<span class="secno">
3.2
</span>
Algorithm
Terms
</a>
</li>
<li class="tocline">
<a href="#context-processing" class="tocxref">
<span class="secno">
3.3
</span>
Context
<ins class="diff-new">Processing
</ins>
</a>
</li>
<li class="tocline">
<a href="#iri-expansion" class="tocxref">
<span class="secno">
3.4
</span>
<abbr title="Internationalized Resource Identifier">
IRI
</abbr>
Expansion
</a>
</li>
<li class="tocline">
<a href="#iri-compaction" class="tocxref">
<span class="secno">
3.5
</span>
<abbr title="Internationalized Resource Identifier">
IRI
</abbr>
Compaction
</a>
<ul class="toc">
<li class="tocline">
<a href="#iri-compaction-algorithm" class="tocxref">
<span class="secno">
<ins class="diff-new">3.5.1
</ins></span><abbr title="Internationalized Resource Identifier"><ins class="diff-new">
IRI
</ins></abbr><ins class="diff-new">
Compaction
Algorithm
</ins></a></li><li class="tocline"><a href="#term-rank-algorithm" class="tocxref"><span class="secno"><ins class="diff-new">
3.5.2
</ins></span><ins class="diff-new">
Term
Rank
Algorithm
</ins></a></li></ul>
</li>
<li class="tocline">
<a href="#value-expansion" class="tocxref">
<span class="secno">
3.6
</span>
Value
Expansion
</a>
</li>
<li class="tocline">
<a href="#value-compaction" class="tocxref">
<span class="secno">
3.7
</span>
Value
Compaction
</a>
</li>
<li class="tocline">
<a href="#generate-blank-node-identifier" class="tocxref">
<span class="secno">
3.8
</span>
<ins class="diff-new">Generate
Blank
Node
Identifier
</ins></a></li><li class="tocline"><a href="#expansion" class="tocxref"><span class="secno"><ins class="diff-new">
3.9
</ins></span>
Expansion
</a>
<ul class="toc">
<li class="tocline">
<a href="#expansion-algorithm" class="tocxref">
<span class="secno">
<del class="diff-old">3.8.1
</del>
<ins class="diff-chg">3.9.1
</ins>
</span>
Expansion
Algorithm
</a>
</li>
</ul>
</li>
<li class="tocline">
<a href="#compaction" class="tocxref">
<span class="secno">
<del class="diff-old">3.9
</del>
<ins class="diff-chg">3.10
</ins>
</span>
Compaction
</a>
<ul class="toc">
<li class="tocline">
<a href="#compaction-algorithm" class="tocxref">
<span class="secno">
<del class="diff-old">3.9.1
</del>
<ins class="diff-chg">3.10.1
</ins>
</span>
Compaction
Algorithm
</a>
</li>
</ul>
</li>
<li class="tocline">
<a href="#framing" class="tocxref">
<span class="secno">
<del class="diff-old">3.10
</del>
<ins class="diff-chg">3.11
</ins>
</span>
Framing
</a>
<ul class="toc">
<li class="tocline">
<a href="#framing-algorithm-terms" class="tocxref">
<span class="secno">
<del class="diff-old">3.10.1
</del>
<ins class="diff-chg">3.11.1
</ins>
</span>
Framing
Algorithm
Terms
</a>
</li>
<li class="tocline">
<a href="#framing-algorithm" class="tocxref">
<span class="secno">
<del class="diff-old">3.10.2
</del>
<ins class="diff-chg">3.11.2
</ins>
</span>
Framing
Algorithm
</a>
</li>
<li class="tocline">
<a href="#subject-flattening" class="tocxref">
<span class="secno">
<ins class="diff-chg">3.11.3
</ins></span><ins class="diff-chg">
Subject
Flattening
</ins></a>
</li>
<li class="tocline">
<a href="#remove-embed" class="tocxref">
<span class="secno">
<del class="diff-old">3.11
</del>
<ins class="diff-chg">3.11.4
</ins>
</span>
<del class="diff-old">Normalization
</del>
<ins class="diff-chg">Remove
Embedded
Definition
</ins>
</a>
</li>
<li class="tocline">
<a href="#embed-values" class="tocxref">
<span class="secno">
<del class="diff-old">3.11.1
</del>
<ins class="diff-chg">3.11.5
</ins>
</span>
<del class="diff-old">Normalization
Algorithm
</del>
<ins class="diff-chg">Embed
Values
</ins>
</a>
</li>
</ul>
</li>
</ul>
</li>
<li class="tocline">
<a href="#data-round-tripping" class="tocxref">
<span class="secno">
<del class="diff-old">3.12
</del>
<ins class="diff-chg">4.
</ins>
</span>
Data
Round
Tripping
</a>
</li>
<li class="tocline">
<a href="#rdf-conversion" class="tocxref">
<span class="secno">
<del class="diff-old">3.13
</del>
<ins class="diff-chg">5.
</ins>
</span>
RDF
Conversion
</a>
<ul class="toc">
<li class="tocline">
<a href="#overview" class="tocxref">
<span class="secno">
<del class="diff-old">3.13.1
</del>
<ins class="diff-chg">5.1
</ins>
</span>
Overview
</a>
</li>
<li class="tocline">
<a href="#rdf-conversion-algorithm-terms" class="tocxref">
<span class="secno">
<del class="diff-old">3.13.2
</del>
<ins class="diff-chg">5.2
</ins>
</span>
RDF
Conversion
Algorithm
Terms
</a>
</li>
<li class="tocline">
<a href="#convert-to-rdf-algorithm" class="tocxref">
<span class="secno">
<del class="diff-old">3.13.3
</del>
<ins class="diff-chg">5.3
</ins>
</span>
<ins class="diff-new">Convert
to
</ins>
RDF
<del class="diff-old">Conversion
</del>
Algorithm
</a>
</li>
<li class="tocline">
<a href="#list-conversion" class="tocxref">
<span class="secno">
<del class="diff-old">3.13.4
</del>
<ins class="diff-chg">5.4
</ins>
</span>
List
Conversion
</a>
</li>
<li class="tocline">
<a href="#convert-from-rdf-algorithm" class="tocxref">
<span class="secno">
<ins class="diff-chg">5.5
</ins></span><ins class="diff-chg">
Convert
from
RDF
Algorithm
</ins></a>
</li>
</ul>
</li>
<li class="tocline">
<a href="#iana-considerations" class="tocxref">
<span class="secno">
A.
</span>
<del class="diff-old">Acknowledgements
</del>
<ins class="diff-chg">IANA
Considerations
</ins>
</a>
</li>
<li class="tocline">
<a href="#appendix-b" class="tocxref">
<span class="secno">
B.
</span>
Initial
Context
</a>
</li>
<li class="tocline">
<a href="#acknowledgements" class="tocxref">
<span class="secno">
C.
</span>
<ins class="diff-new">Acknowledgements
</ins></a></li><li class="tocline"><a href="#references" class="tocxref"><span class="secno"><ins class="diff-new">
D.
</ins></span>
References
</a>
<ul class="toc">
<li class="tocline">
<a href="#normative-references" class="tocxref">
<span class="secno">
<del class="diff-old">C.1
</del>
<ins class="diff-chg">D.1
</ins>
</span>
Normative
references
</a>
</li>
<li class="tocline">
<a href="#informative-references" class="tocxref">
<span class="secno">
<del class="diff-old">C.2
</del>
<ins class="diff-chg">D.2
</ins>
</span>
Informative
references
</a>
</li>
</ul>
</li>
</ul>
</div>
<div id="introduction" class="section">
<h2>
<span class="secno">
1.
</span>
Introduction
</h2>
<p>
JSON,
as
specified
in
[
<cite>
<a class="bibref" rel="biblioentry" href="#bib-RFC4627">
RFC4627
</a>
</cite>
],
is
a
simple
language
for
representing
data
on
the
Web.
Linked
Data
is
a
technique
for
creating
a
graph
of
interlinked
data
across
different
documents
or
Web
sites.
Data
entities
are
described
using
<a class="tref internalDFN" title="iri" href="#dfn-iri">
<abbr title="Internationalized Resource Identifier">
IRI
</abbr>
</a>
s,
which
are
typically
dereferencable
and
thus
may
be
used
to
find
more
information
about
an
entity,
creating
a
&quot;Web
of
Knowledge&quot;.
JSON-LD
is
intended
to
be
a
simple
publishing
method
for
expressing
not
only
Linked
Data
in
JSON,
but
also
for
adding
semantics
to
existing
JSON.
</p>
<p>
JSON-LD
is
designed
as
a
light-weight
syntax
that
can
be
used
to
express
Linked
Data.
It
is
primarily
intended
to
be
a
way
to
use
Linked
Data
in
Javascript
and
other
Web-based
programming
environments.
It
is
also
useful
when
building
interoperable
Web
services
and
when
storing
Linked
Data
in
JSON-based
document
storage
engines.
It
is
practical
and
designed
to
be
as
simple
as
possible,
utilizing
the
large
number
of
JSON
parsers
and
libraries
available
today.
It
is
designed
to
be
able
to
express
key-value
pairs,
RDF
data,
RDFa
[
<cite>
<a class="bibref" rel="biblioentry" href="#bib-RDFA-CORE">
RDFA-CORE
</a>
</cite>
]
data,
Microformats
[
<cite>
<a class="bibref" rel="biblioentry" href="#bib-MICROFORMATS">
MICROFORMATS
</a>
</cite>
]
data,
and
Microdata
[
<cite>
<a class="bibref" rel="biblioentry" href="#bib-MICRODATA">
MICRODATA
</a>
</cite>
].
That
is,
it
supports
every
major
Web-based
structured
data
model
in
use
today.
</p>
<p>
The
syntax
does
not
necessarily
require
applications
to
change
their
JSON,
but
allows
to
easily
add
meaning
by
adding
context
in
a
way
that
is
either
in-band
or
out-of-band.
The
syntax
is
designed
to
not
disturb
already
deployed
systems
running
on
JSON,
but
provide
a
smooth
upgrade
path
from
JSON
to
JSON
with
added
semantics.
Finally,
the
format
is
intended
to
be
easy
to
parse,
efficient
to
generate,
convertible
to
RDF
in
one
pass,
and
require
a
very
small
memory
footprint
in
order
to
operate.
</p>
<div id="how-to-read-this-document" class="section">
<h3>
<span class="secno">
1.1
</span>
How
to
Read
this
Document
</h3>
<p>
This
document
is
a
detailed
specification
for
a
serialization
of
Linked
Data
in
JSON.
The
document
is
primarily
intended
for
the
following
audiences:
</p>
<ul>
<li>
Authors
that
want
a
very
detailed
view
of
how
JSON-LD
processors
operate.
</li>
<li>
Software
developers
that
want
to
implement
processors
and
APIs
for
JSON-LD.
</li>
</ul>
<p>
To
understand
the
basics
in
this
specification
you
must
first
be
familiar
with
JSON,
which
is
detailed
in
[
<cite>
<a class="bibref" rel="biblioentry" href="#bib-RFC4627">
RFC4627
</a>
</cite>
].
You
must
also
understand
the
JSON-LD
Syntax
[
<cite>
<a class="bibref" rel="biblioentry" href="#bib-JSON-LD">
JSON-LD
</a>
</cite>
],
which
is
the
base
syntax
used
by
all
of
the
algorithms
in
this
document.
To
understand
the
API
and
how
it
is
intended
to
operate
in
a
programming
environment,
it
is
useful
to
have
working
knowledge
of
the
JavaScript
programming
language
[
<cite>
<a class="bibref" rel="biblioentry" href="#bib-ECMA-262">
ECMA-262
</a>
</cite>
]
and
WebIDL
[
<cite>
<a class="bibref" rel="biblioentry" href="#bib-WEBIDL">
WEBIDL
</a>
</cite>
].
To
understand
how
JSON-LD
maps
to
RDF,
it
is
helpful
to
be
familiar
with
the
basic
RDF
concepts
[
<cite>
<a class="bibref" rel="biblioentry" href="#bib-RDF-CONCEPTS">
RDF-CONCEPTS
</a>
</cite>
].
</p>
<p>
Examples
may
contain
references
to
existing
vocabularies
and
use
<a class="tref internalDFN" title="prefix" href="#dfn-prefix">
prefix
</a>
es
to
refer
to
<del class="diff-old">Web
Vocabularies.
</del>
<ins class="diff-chg">vocabularies.
</ins>
The
following
is
a
list
of
all
vocabularies
and
their
<a class="tref internalDFN" title="prefix" href="#dfn-prefix">
prefix
</a>
abbreviations,
as
used
in
this
document:
</p>
<ul>
<li>
The
<a href="http://purl.org/dc/terms/">
Dublin
Core
</a>
vocabulary
(abbreviation:
<code>
dc
</code>,
e.g.,
<code>
dc:title
</code>
)
</li>
<li>
The
<a href="http://xmlns.com/foaf/0.1/">
Friend
of
a
Friend
</a>
vocabulary
(abbreviation:
<code>
foaf
</code>,
e.g.,
<code>
foaf:knows
</code>
)
</li>
<li>
The
<a href="http://www.w3.org/1999/02/22-rdf-syntax-ns#">
RDF
</a>
vocabulary
(abbreviation:
<code>
rdf
</code>,
e.g.,
<code>
rdf:type
</code>
)
</li>
<li>
The
<a href="http://www.w3.org/2001/XMLSchema#">
XSD
</a>
vocabulary
(abbreviation:
<code>
xsd
</code>,
e.g.,
<code>
xsd:integer
</code>
)
</li>
</ul>
<p>
JSON
[
<cite>
<a class="bibref" rel="biblioentry" href="#bib-RFC4627">
RFC4627
</a>
</cite>
]
defines
several
terms
which
are
used
throughout
this
document:
</p>
<dl>
<dt>
<dfn title="json_object" id="dfn-json_object">
JSON
<del class="diff-old">Object
</del>
<ins class="diff-chg">object
</ins>
</dfn>
</dt>
<dd>
An
object
structure
is
represented
as
a
pair
of
curly
brackets
surrounding
zero
or
more
name/value
pairs
(or
members).
A
name
is
a
<a class="tref internalDFN" title="string" href="#dfn-string">
string
</a>.
A
single
colon
comes
after
each
name,
separating
the
name
from
the
value.
A
single
comma
separates
a
value
from
a
following
name.
The
names
within
an
object
<em class="rfc2119" title="should">
should
</em>
be
unique.
</dd>
<dt>
<dfn title="array" id="dfn-array">
array
</dfn>
</dt>
<dd>
An
array
is
an
ordered
collection
of
values.
An
array
structure
is
represented
as
square
brackets
surrounding
zero
or
more
values
(or
elements).
Elements
are
separated
by
commas.
Within
JSON-LD,
array
order
is
not
preserved
by
default,
unless
specific
markup
is
<del class="diff-old">provided
(see
Lists
).
</del>
<ins class="diff-chg">provided.
</ins>
This
is
because
the
basic
data
model
of
JSON-LD
is
a
<a class="tref internalDFN" title="linked_data_graph" href="#dfn-linked_data_graph">
linked
data
graph
</a>,
which
is
inherently
unordered.
</dd>
<dt>
<dfn title="string" id="dfn-string">
string
</dfn>
</dt>
<dd>
A
string
is
a
sequence
of
zero
or
more
Unicode
characters,
wrapped
in
double
quotes,
using
backslash
escapes.
A
character
is
represented
as
a
single
character
string.
</dd>
<dt>
<dfn title="number" id="dfn-number">
number
</dfn>
</dt>
<dd>
A
number
is
is
similar
to
that
used
in
most
programming
languages,
except
that
the
octal
and
hexadecimal
formats
are
not
used
and
that
leading
zeros
are
not
allowed.
</dd>
<dt>
<dfn title="true" id="dfn-true">
true
</dfn>
and
<dfn title="false" id="dfn-false">
false
</dfn>
</dt>
<dd>
Boolean
values.
</dd>
<dt>
<dfn title="null" id="dfn-null">
null
</dfn>
</dt>
<dd>
The
use
of
the
<a class="tref internalDFN" title="null" href="#dfn-null">
null
</a>
value
<del class="diff-old">is
undefined
</del>
within
<del class="diff-old">JSON-LD.
Supporting
null
in
</del>
JSON-LD
<del class="diff-old">might
have
</del>
<ins class="diff-chg">is
used
to
ignore
or
reset
values.
</ins></dd><dt><dfn title="subject_definition" id="dfn-subject_definition"><ins class="diff-chg">
subject
definition
</ins></dfn></dt><dd><ins class="diff-chg">
A
</ins><a class="tref internalDFN" title="json_object" href="#dfn-json_object"><ins class="diff-chg">
JSON
object
</ins></a><ins class="diff-chg">
used
to
represent
</ins>
a
<del class="diff-old">number
of
advantages
</del>
<a class="tref internalDFN" title="subject" href="#dfn-subject">
<ins class="diff-chg">subject
</ins></a>
and
<del class="diff-old">should
be
evaluated.
This
</del>
<ins class="diff-chg">one
or
more
properties
of
that
subject.
A
</ins><a class="tref internalDFN" title="json_object" href="#dfn-json_object"><ins class="diff-chg">
JSON
object
</ins></a>
is
<del class="diff-old">currently
an
open
issue
.
</del>
<ins class="diff-chg">a
subject
definition
if
it
does
not
contain
they
keys
</ins><code><ins class="diff-chg">
@value
</ins></code>,<code><ins class="diff-chg">
@list
</ins></code><ins class="diff-chg">
or
</ins><code><ins class="diff-chg">
@set
</ins></code><ins class="diff-chg">
and
it
has
one
or
more
keys
other
than
</ins><code><ins class="diff-chg">
@id
</ins></code>.</dd><dt><dfn title="subject_reference" id="dfn-subject_reference"><ins class="diff-chg">
subject
reference
</ins></dfn></dt><dd><ins class="diff-chg">
A
</ins><a class="tref internalDFN" title="json_object" href="#dfn-json_object"><ins class="diff-chg">
JSON
object
</ins></a><ins class="diff-chg">
used
to
reference
a
subject
having
only
the
</ins><code><ins class="diff-chg">
@id
</ins></code><ins class="diff-chg">
key.
</ins>
</dd>
</dl>
<p>
</p>
</div>
<div id="linked-data" class="section">
<h3>
<span class="secno">
1.2
</span>
Linked
Data
</h3>
<p>
The
following
definition
for
<a class="tref internalDFN" title="linked_data" href="#dfn-linked_data">
Linked
Data
</a>
is
the
one
that
will
be
used
for
this
specification.
</p>
<ol>
<li>
<dfn title="linked_data" id="dfn-linked_data">
Linked
Data
</dfn>
is
a
set
of
documents,
each
containing
a
representation
of
a
linked
data
graph.
</li>
<li>
A
<dfn title="linked_data_graph" id="dfn-linked_data_graph">
linked
data
graph
</dfn>
is
an
unordered
labeled
directed
graph,
where
nodes
are
<a class="tref internalDFN" title="subject" href="#dfn-subject">
subject
</a>
s
or
<a class="tref internalDFN" title="object" href="#dfn-object">
object
</a>
s,
and
edges
are
properties.
</li>
<li>
A
<dfn title="subject" id="dfn-subject">
subject
</dfn>
is
any
node
in
a
<a class="tref internalDFN" title="linked_data_graph" href="#dfn-linked_data_graph">
linked
data
graph
</a>
with
at
least
one
outgoing
edge.
</li>
<li>
A
<a class="tref internalDFN" title="subject" href="#dfn-subject">
subject
</a>
<em class="rfc2119" title="should">
should
</em>
be
labeled
with
an
<a class="tref internalDFN" title="iri" href="#dfn-iri">
<abbr title="Internationalized Resource Identifier">
IRI
</abbr>
</a>
(an
Internationalized
Resource
Identifier
as
described
in
[
<cite>
<a class="bibref" rel="biblioentry" href="#bib-RFC3987">
RFC3987
</a>
</cite>
]).
</li>
<li>
An
<dfn title="object" id="dfn-object">
object
</dfn>
is
a
node
in
a
<a class="tref internalDFN" title="linked_data_graph" href="#dfn-linked_data_graph">
linked
data
graph
</a>
with
at
least
one
incoming
edge.
</li>
<li>
An
<a class="tref internalDFN" title="object" href="#dfn-object">
object
</a>
<em class="rfc2119" title="may">
may
</em>
be
labeled
with
an
<a class="tref internalDFN" title="iri" href="#dfn-iri">
<abbr title="Internationalized Resource Identifier">
IRI
</abbr>
</a>.
</li>
<li>
An
object
<em class="rfc2119" title="may">
may
</em>
be
a
<a class="tref internalDFN" title="subject" href="#dfn-subject">
subject
</a>
and
<a class="tref internalDFN" title="object" href="#dfn-object">
object
</a>
at
the
same
time.
</li>
<li>
A
<dfn title="property" id="dfn-property">
property
</dfn>
is
an
edge
of
the
<a class="tref internalDFN" title="linked_data_graph" href="#dfn-linked_data_graph">
linked
data
graph
</a>.
</li>
<li>
A
<a class="tref internalDFN" title="property" href="#dfn-property">
property
</a>
<em class="rfc2119" title="should">
should
</em>
be
labeled
with
an
<a class="tref internalDFN" title="iri" href="#dfn-iri">
<abbr title="Internationalized Resource Identifier">
IRI
</abbr>
</a>.
</li>
<li>
An
<a class="tref internalDFN" title="iri" href="#dfn-iri">
<abbr title="Internationalized Resource Identifier">
IRI
</abbr>
</a>
that
is
a
label
in
a
<a class="tref internalDFN" title="linked_data_graph" href="#dfn-linked_data_graph">
linked
data
graph
</a>
<em class="rfc2119" title="should">
should
</em>
be
dereferencable
to
a
<a class="tref internalDFN" title="linked_data" href="#dfn-linked_data">
Linked
Data
</a>
document
describing
the
labeled
<a class="tref internalDFN" title="subject" href="#dfn-subject">
subject
</a>,
<a class="tref internalDFN" title="object" href="#dfn-object">
object
</a>
or
<a class="tref internalDFN" title="property" href="#dfn-property">
property
</a>.
</li>
<li>
A
<dfn title="literal" id="dfn-literal">
literal
</dfn>
is
an
<a class="tref internalDFN" title="object" href="#dfn-object">
object
</a>
with
a
label
that
is
not
an
<a class="tref internalDFN" title="iri" href="#dfn-iri">
<abbr title="Internationalized Resource Identifier">
IRI
</abbr>
</a>
</li>
</ol>
<p>
Note
that
the
definition
for
<a class="tref internalDFN" title="linked_data" href="#dfn-linked_data">
Linked
Data
</a>
above
is
silent
on
the
topic
of
unlabeled
nodes.
Unlabeled
nodes
are
not
considered
<a class="tref internalDFN" title="linked_data" href="#dfn-linked_data">
Linked
Data
</a>.
However,
this
specification
allows
for
the
expression
of
unlabled
nodes,
as
most
graph-based
data
sets
on
the
Web
contain
a
number
of
associated
nodes
that
are
not
named
and
thus
are
not
directly
de-referenceable.
</p>
</div>
<div id="contributing" class="section">
<h3>
<span class="secno">
1.3
</span>
Contributing
</h3>
<p>
There
are
a
number
of
ways
that
one
may
participate
in
the
development
of
this
specification:
</p>
<ul>
<li>
Technical
discussion
typically
occurs
on
the
public
mailing
list:
<a href="http://lists.w3.org/Archives/Public/public-linked-json/">
public-linked-json@w3.org
</a>
</li>
<li>
<a href="http://json-ld.org/minutes/">
Public
teleconferences
</a>
are
held
on
Tuesdays
at
1500UTC
on
the
second
and
fourth
week
of
each
month.
</li>
<li>
Specification
bugs
and
issues
should
be
reported
in
the
<a href="https://github.com/json-ld/json-ld.org/issues">
issue
tracker
</a>.
</li>
<li>
<a href="https://github.com/json-ld/json-ld.org/tree/main/spec">
Source
code
</a>
for
the
specification
can
be
found
on
Github.
</li>
<li>
The
<a href="http://webchat.freenode.net/?channels=json-ld">
#json-ld
</a>
IRC
channel
is
available
for
real-time
discussion
on
irc.freenode.net.
</li>
</ul>
</div>
</div>
<div id="the-application-programming-interface" class="section">
<h2>
<span class="secno">
2.
</span>
The
Application
Programming
Interface
</h2>
<p>
This
API
provides
a
clean
mechanism
that
enables
developers
to
convert
JSON-LD
data
into
a
a
variety
of
output
formats
that
are
easier
to
work
with
in
various
programming
languages.
If
a
JSON-LD
API
is
provided
in
a
programming
environment,
the
entirety
of
the
following
API
<em class="rfc2119" title="must">
must
</em>
be
implemented.
</p>
<div id="jsonldprocessor" class="section">
<h3>
<span class="secno">
2.1
</span>
JsonLdProcessor
</h3>
<del class="diff-old">    ]
</del>
    <pre class="idl"><span id="idl-def-JsonLdProcessor" class="idlInterface">[<span class="extAttr">NoInterfaceObject</span>]
interface <span class="idlInterfaceID">JsonLdProcessor</span> {
<span class="idlMethod">    <span class="idlMethType"><a>void</a></span> <span class="idlMethName"><a href="#widl-JsonLdProcessor-expand-void-object-or-object---or-URL-input-JsonLdCallback-callback-JsonLdOptions-options">expand</a></span> (<span class="idlParam"><span class="idlParamType"><a>object or object[] or URL</a></span> <span class="idlParamName">input</span></span>, <span class="idlParam"><span class="idlParamType"><a href="#idl-def-JsonLdCallback" class="idlType"><code>JsonLdCallback</code></a></span> <span class="idlParamName">callback</span></span>, <span class="idlParam">optional <span class="idlParamType"><a href="#idl-def-JsonLdOptions" class="idlType"><code>JsonLdOptions</code></a></span> <span class="idlParamName">options</span></span>);</span>
<span class="idlMethod">    <span class="idlMethType"><a>void</a></span> <span class="idlMethName"><a href="#widl-JsonLdProcessor-compact-void-object-or-object---or-URL-input-object-or-URL-context-JsonLdCallback-callback-JsonLdOptions-options">compact</a></span> (<span class="idlParam"><span class="idlParamType"><a>object or object[] or URL</a></span> <span class="idlParamName">input</span></span>, <span class="idlParam"><span class="idlParamType"><a>object or URL</a></span> <span class="idlParamName">context</span></span>, <span class="idlParam"><span class="idlParamType"><a href="#idl-def-JsonLdCallback" class="idlType"><code>JsonLdCallback</code></a></span> <span class="idlParamName">callback</span></span>, <span class="idlParam">optional <span class="idlParamType"><a href="#idl-def-JsonLdOptions" class="idlType"><code>JsonLdOptions</code></a></span> <span class="idlParamName">options</span></span>);</span>
<span class="idlMethod">    <span class="idlMethType"><a>void</a></span> <span class="idlMethName"><a href="#widl-JsonLdProcessor-frame-void-object-or-object---or-URL-input-object-or-URL-frame-JsonLdCallback-callback-JsonLdOptions-options">frame</a></span> (<span class="idlParam"><span class="idlParamType"><a>object or object[] or URL</a></span> <span class="idlParamName">input</span></span>, <span class="idlParam"><span class="idlParamType"><a>object or URL</a></span> <span class="idlParamName">frame</span></span>, <span class="idlParam"><span class="idlParamType"><a href="#idl-def-JsonLdCallback" class="idlType"><code>JsonLdCallback</code></a></span> <span class="idlParamName">callback</span></span>, <span class="idlParam">optional <span class="idlParamType"><a href="#idl-def-JsonLdOptions" class="idlType"><code>JsonLdOptions</code></a></span> <span class="idlParamName">options</span></span>);</span>
<span class="idlMethod">    <span class="idlMethType"><a>void</a></span> <span class="idlMethName"><a href="#widl-JsonLdProcessor-fromRDF-void-StatementArray-input-JsonLdCallback-callback-JsonLdOptions-options">fromRDF</a></span> (<span class="idlParam"><span class="idlParamType"><a href="#idl-def-Statement" class="idlType"><code>Statement</code></a>[]</span> <span class="idlParamName">input</span></span>, <span class="idlParam"><span class="idlParamType"><a href="#idl-def-JsonLdCallback" class="idlType"><code>JsonLdCallback</code></a></span> <span class="idlParamName">callback</span></span>, <span class="idlParam">optional <span class="idlParamType"><a href="#idl-def-JsonLdOptions" class="idlType"><code>JsonLdOptions</code></a></span> <span class="idlParamName">options</span></span>);</span>
<span class="idlMethod">    <span class="idlMethType"><a>void</a></span> <span class="idlMethName"><a href="#widl-JsonLdProcessor-toRDF-void-object-or-object---or-URL-input-ObjectOrURL-context-StatementCallback-callback-JsonLdOptions-options">toRDF</a></span> (<span class="idlParam"><span class="idlParamType"><a>object or object[] or URL</a></span> <span class="idlParamName">input</span></span>, <span class="idlParam"><span class="idlParamType"><a>ObjectOrURL</a>?</span> <span class="idlParamName">context</span></span>, <span class="idlParam"><span class="idlParamType"><a href="#idl-def-StatementCallback" class="idlType"><code>StatementCallback</code></a></span> <span class="idlParamName">callback</span></span>, <span class="idlParam">optional <span class="idlParamType"><a href="#idl-def-JsonLdOptions" class="idlType"><code>JsonLdOptions</code></a></span> <span class="idlParamName">options</span></span>);</span>
};</span>
</pre>
<div id="methods" class="section">
<h4>
<span class="secno">
2.1.1
</span>
Methods
</h4>
<dl class="methods">
<dt id="widl-JsonLdProcessor-compact-void-object-or-object---or-URL-input-object-or-URL-context-JsonLdCallback-callback-JsonLdOptions-options">
<code>
compact
</code>
</dt>
<dd>
<a href="#compaction">
Compacts
</a>
the
given
<code>
input
</code>
<ins class="diff-new">using
the
</ins><code><ins class="diff-new">
context
</ins></code>
according
to
the
steps
in
the
<a href="#compaction-algorithm">
Compaction
Algorithm
</a>.
The
<code>
input
</code>
<em class="rfc2119" title="must">
must
</em>
be
copied,
compacted
and
returned
if
there
are
no
errors.
If
the
compaction
fails,
an
appropirate
exception
<em class="rfc2119" title="must">
must
</em>
be
thrown.
<table class="parameters">
<tr>
<th>
Parameter
</th>
<th>
Type
</th>
<th>
Nullable
</th>
<th>
Optional
</th>
<th>
Description
</th>
</tr>
<tr>
<td class="prmName">
input
</td>
<td class="prmType">
<code>
<a>
object
<ins class="diff-new">or
object[]
or
URL
</ins>
</a>
</code>
</td>
<td class="prmNullFalse">
✘
</td>
<td class="prmOptFalse">
✘
</td>
<td class="prmDesc">
The
JSON-LD
object
<ins class="diff-new">or
array
of
JSON-LD
objects
</ins>
to
perform
<ins class="diff-new">the
</ins>
compaction
<del class="diff-old">on.
</del>
<ins class="diff-chg">upon
or
an
</ins><a class="tref internalDFN" title="iri" href="#dfn-iri"><abbr title="Internationalized Resource Identifier"><ins class="diff-chg">
IRI
</ins></abbr></a><ins class="diff-chg">
referencing
the
JSON-LD
document
to
compact.
</ins>
</td>
</tr>
<tr>
<td class="prmName">
context
</td>
<td class="prmType">
<code>
<a>
object
<ins class="diff-new">or
URL
</ins>
</a>
</code>
</td>
<del class="diff-old">✔
</del>
<td class="prmNullFalse">
<ins class="diff-chg">✘
</ins>
</td>
<del class="diff-old">✔
</del>
<td class="prmOptFalse">
<ins class="diff-chg">✘
</ins>
</td>
<td class="prmDesc">
The
<del class="diff-old">base
</del>
context
to
use
when
compacting
the
<code>
input
<del class="diff-old">.
</del>
</code>
<ins class="diff-chg">;
either
in
the
form
of
an
</ins><a class="tref internalDFN" title="json_object" href="#dfn-json_object"><ins class="diff-chg">
JSON
object
</ins></a><ins class="diff-chg">
or
as
</ins><a class="tref internalDFN" title="iri" href="#dfn-iri">
<del class="diff-old">Exception
</del>
<abbr title="Internationalized Resource Identifier">
<ins class="diff-chg">IRI
</ins></abbr>
<del class="diff-old">Description
</del>
</a>.
</td>
</tr>
<tr>
<del class="diff-old">InvalidContext
</del>
<td class="prmName">
<ins class="diff-chg">callback
</ins>
</td>
<td class="prmType">
<code>
<del class="diff-old">INVALID_SYNTAX
</del>
<a href="#idl-def-JsonLdCallback" class="idlType">
<del class="diff-old">A
general
syntax
error
was
detected
in
the
@context
.
For
example,
if
a
</del>
<code>
<del class="diff-old">@type
key
maps
to
anything
other
than
@id
</del>
<ins class="diff-chg">JsonLdCallback
</ins>
</code>
<del class="diff-old">or
an
absolute
IRI
,
this
exception
would
be
raised.
</del>
</a>
<del class="diff-old">LOAD_ERROR
</del>
</code>
</td>
<del class="diff-old">There
was
a
problem
encountered
loading
a
remote
context.
</del>
<td class="prmNullFalse">
<ins class="diff-chg">✘
</ins>
</td>
<td class="prmOptFalse">
<ins class="diff-chg">✘
</ins></td>
<td class="prmDesc">
<ins class="diff-new">A
callback
that
is
called
when
processing
is
complete
on
the
given
</ins><code><ins class="diff-new">
input
</ins></code>.
</td>
</tr>
<tr>
<del class="diff-old">ProcessingError
</del>
<td class="prmName">
<ins class="diff-chg">options
</ins>
</td>
<td class="prmType">
<code>
<del class="diff-old">LOSSY_COMPACTION
</del>
<a href="#idl-def-JsonLdOptions" class="idlType">
<del class="diff-old">The
compaction
would
lead
to
a
loss
of
information,
such
as
a
</del>
<code>
<del class="diff-old">@language
</del>
<ins class="diff-chg">JsonLdOptions
</ins>
</code>
<del class="diff-old">value.
</del>
</a>
</code>
</td>
<del class="diff-old">CONFLICTING_DATATYPES
</del>
<td class="prmNullFalse">
<ins class="diff-chg">✘
</ins></td>
<td class="prmOptTrue">
<ins class="diff-new">✔
</ins>
</td>
<del class="diff-old">The
target
datatype
specified
in
the
coercion
rule
and
</del>
<td class="prmDesc">
<ins class="diff-chg">A
set
of
options
that
</ins><em class="rfc2119" title="may"><ins class="diff-chg">
may
</ins></em><ins class="diff-chg">
affect
</ins>
the
<del class="diff-old">datatype
for
</del>
<ins class="diff-chg">expansion
algorithm
such
as,
e.g.,
</ins>
the
<del class="diff-old">typed
literal
do
not
match.
</del>
<ins class="diff-chg">input
document's
base
</ins><a class="tref internalDFN" title="iri" href="#dfn-iri">
<abbr title="Internationalized Resource Identifier">
<ins class="diff-chg">IRI
</ins></abbr>
</a>.
<ins class="diff-new">This
also
includes
</ins><code><ins class="diff-new">
optimize
</ins></code>,<ins class="diff-new">
which
if
set
will
cause
processor-specific
optimization.
</ins>
</td>
</tr>
</table>
<div>
<em>
Return
type:
</em>
<code>
<a>
<del class="diff-old">object
</del>
<ins class="diff-chg">void
</ins>
</a>
</code>
</div>
</dd>
<dt id="widl-JsonLdProcessor-expand-void-object-or-object---or-URL-input-JsonLdCallback-callback-JsonLdOptions-options">
<code>
expand
</code>
</dt>
<dd>
<a href="#expansion">
Expands
</a>
the
given
<code>
input
</code>
according
to
the
steps
in
the
<a href="#expansion-algorithm">
Expansion
Algorithm
</a>.
The
<code>
input
</code>
<em class="rfc2119" title="must">
must
</em>
be
copied,
expanded
and
returned
if
there
are
no
errors.
If
the
expansion
fails,
an
appropriate
exception
<em class="rfc2119" title="must">
must
</em>
be
thrown.
<table class="parameters">
<tr>
<th>
Parameter
</th>
<th>
Type
</th>
<th>
Nullable
</th>
<th>
Optional
</th>
<th>
Description
</th>
</tr>
<tr>
<td class="prmName">
input
</td>
<td class="prmType">
<code>
<a>
object
<ins class="diff-new">or
object[]
or
URL
</ins>
</a>
</code>
</td>
<td class="prmNullFalse">
✘
</td>
<td class="prmOptFalse">
✘
</td>
<td class="prmDesc">
The
JSON-LD
object
<ins class="diff-new">or
array
of
JSON-LD
objects
</ins>
to
<del class="diff-old">copy
and
</del>
perform
the
expansion
<del class="diff-old">upon.
</del>
<ins class="diff-chg">upon
or
an
</ins><a class="tref internalDFN" title="iri" href="#dfn-iri"><abbr title="Internationalized Resource Identifier"><ins class="diff-chg">
IRI
</ins></abbr></a><ins class="diff-chg">
referencing
the
JSON-LD
document
to
expand.
</ins>
</td>
</tr>
<tr>
<td class="prmName">
<del class="diff-old">context
</del>
<ins class="diff-chg">callback
</ins>
</td>
<td class="prmType">
<code>
<del class="diff-old">object
</del>
<a href="#idl-def-JsonLdCallback" class="idlType">
<code>
<ins class="diff-chg">JsonLdCallback
</ins></code>
</a>
</code>
</td>
<del class="diff-old">✔
</del>
<td class="prmNullFalse">
<ins class="diff-chg">✘
</ins>
</td>
<del class="diff-old">✔
</del>
<td class="prmOptFalse">
<ins class="diff-chg">✘
</ins>
</td>
<td class="prmDesc">
<del class="diff-old">An
external
context
to
use
additionally
to
the
context
embedded
in
input
</del>
<ins class="diff-chg">A
callback
that
is
called
</ins>
when
<del class="diff-old">expanding
</del>
<ins class="diff-chg">processing
is
complete
on
</ins>
the
<ins class="diff-new">given
</ins>
<code>
input
</code>.
</td>
</tr>
<tr>
<del class="diff-old">Exception
Description
InvalidContext
</del>
<td class="prmName">
<ins class="diff-chg">options
</ins>
</td>
<td class="prmType">
<code>
<del class="diff-old">INVALID_SYNTAX
</del>
<a href="#idl-def-JsonLdOptions" class="idlType">
<del class="diff-old">A
general
syntax
error
was
detected
in
the
</del>
<code>
<del class="diff-old">@context
.
For
example,
if
a
@type
key
maps
to
anything
other
than
@id
</del>
<ins class="diff-chg">JsonLdOptions
</ins>
</code>
<del class="diff-old">or
an
absolute
IRI
,
this
exception
would
be
raised.
</del>
</a>
<del class="diff-old">LOAD_ERROR
</del>
</code>
</td>
<del class="diff-old">There
was
a
problem
encountered
loading
a
remote
context.
</del>
<td class="prmNullFalse">
<ins class="diff-chg">✘
</ins>
</td>
<td class="prmOptTrue">
<ins class="diff-chg">✔
</ins></td>
<td class="prmDesc">
<ins class="diff-chg">A
set
of
options
that
</ins><em class="rfc2119" title="may"><ins class="diff-chg">
may
</ins></em><ins class="diff-chg">
affect
the
expansion
algorithm
such
as,
e.g.,
the
input
document's
base
</ins><a class="tref internalDFN" title="iri" href="#dfn-iri"><abbr title="Internationalized Resource Identifier"><ins class="diff-chg">
IRI
</ins></abbr>
</a>.
</td>
</tr>
</table>
<div>
<em>
Return
type:
</em>
<code>
<a>
<del class="diff-old">object
</del>
<ins class="diff-chg">void
</ins>
</a>
</code>
</div>
</dd>
<dt id="widl-JsonLdProcessor-frame-void-object-or-object---or-URL-input-object-or-URL-frame-JsonLdCallback-callback-JsonLdOptions-options">
<code>
frame
</code>
</dt>
<dd>
<a href="#framing">
Frames
</a>
the
given
<code>
input
</code>
using
the
<code>
frame
</code>
according
to
the
steps
in
the
<a href="#framing-algorithm">
Framing
Algorithm
</a>.
The
<code>
input
</code>
is
used
to
build
the
framed
output
and
is
returned
if
there
are
no
errors.
If
there
are
no
matches
for
the
frame,
<a class="tref internalDFN" title="null" href="#dfn-null">
null
</a>
<em class="rfc2119" title="must">
must
</em>
be
returned.
Exceptions
<em class="rfc2119" title="must">
must
</em>
be
thrown
if
there
are
errors.
<table class="parameters">
<tr>
<th>
Parameter
</th>
<th>
Type
</th>
<th>
Nullable
</th>
<th>
Optional
</th>
<th>
Description
</th>
</tr>
<tr>
<td class="prmName">
input
</td>
<td class="prmType">
<code>
<a>
object
<ins class="diff-new">or
object[]
or
URL
</ins>
</a>
</code>
</td>
<td class="prmNullFalse">
✘
</td>
<td class="prmOptFalse">
✘
</td>
<td class="prmDesc">
The
JSON-LD
object
<ins class="diff-new">or
array
of
JSON-LD
objects
</ins>
to
perform
<ins class="diff-new">the
</ins>
framing
<del class="diff-old">on.
</del>
<ins class="diff-chg">upon
or
an
</ins><a class="tref internalDFN" title="iri" href="#dfn-iri"><abbr title="Internationalized Resource Identifier"><ins class="diff-chg">
IRI
</ins></abbr></a><ins class="diff-chg">
referencing
the
JSON-LD
document
to
frame.
</ins>
</td>
</tr>
<tr>
<td class="prmName">
frame
</td>
<td class="prmType">
<code>
<a>
object
<ins class="diff-new">or
URL
</ins>
</a>
</code>
</td>
<td class="prmNullFalse">
✘
</td>
<td class="prmOptFalse">
✘
</td>
<td class="prmDesc">
The
frame
to
use
when
re-arranging
the
<del class="diff-old">data.
</del>
<ins class="diff-chg">data
of
</ins><code><ins class="diff-chg">
input
</ins></code><ins class="diff-chg">
;
either
in
the
form
of
an
</ins><a class="tref internalDFN" title="json_object" href="#dfn-json_object"><ins class="diff-chg">
JSON
object
</ins></a><ins class="diff-chg">
or
as
</ins><a class="tref internalDFN" title="iri" href="#dfn-iri"><abbr title="Internationalized Resource Identifier"><ins class="diff-chg">
IRI
</ins></abbr></a>.
</td>
</tr>
<tr>
<td class="prmName">
<del class="diff-old">options
</del>
<ins class="diff-chg">callback
</ins>
</td>
<td class="prmType">
<code>
<del class="diff-old">object
</del>
<a href="#idl-def-JsonLdCallback" class="idlType">
<code>
<ins class="diff-chg">JsonLdCallback
</ins></code>
</a>
</code>
</td>
<td class="prmNullFalse">
✘
</td>
<td class="prmOptFalse">
✘
</td>
<td class="prmDesc">
A
<del class="diff-old">set
of
options
</del>
<ins class="diff-chg">callback
</ins>
that
<del class="diff-old">will
affect
</del>
<ins class="diff-chg">is
called
when
processing
is
complete
on
</ins>
the
<del class="diff-old">framing
algorithm.
</del>
<ins class="diff-chg">given
</ins><code><ins class="diff-chg">
input
</ins></code>.
</td>
</tr>
<tr>
<del class="diff-old">Exception
</del>
<td class="prmName">
<ins class="diff-chg">options
</ins></td>
<del class="diff-old">Description
</del>
<td class="prmType">
<code>
<a href="#idl-def-JsonLdOptions" class="idlType">
<code>
<ins class="diff-chg">JsonLdOptions
</ins></code>
<del class="diff-old">InvalidFrame
</del>
</a>
<del class="diff-old">INVALID_SYNTAX
</del>
</code>
</td>
<del class="diff-old">A
frame
must
be
either
an
object
or
an
array
of
objects,
if
the
frame
is
neither
of
these
types,
this
exception
is
thrown.
</del>
<td class="prmNullFalse">
<ins class="diff-chg">✘
</ins>
</td>
<del class="diff-old">MULTIPLE_EMBEDS
</del>
<td class="prmOptTrue">
<ins class="diff-chg">✔
</ins>
</td>
<td class="prmDesc">
A
<del class="diff-old">subject
IRI
was
specified
in
more
than
one
place
in
</del>
<ins class="diff-chg">set
of
options
that
</ins><em class="rfc2119" title="may"><ins class="diff-chg">
may
</ins></em><ins class="diff-chg">
affect
the
framing
algorithm
such
as,
e.g.,
</ins>
the
input
<del class="diff-old">frame.
More
than
one
embed
of
a
given
subject
</del>
<ins class="diff-chg">document's
base
</ins><a class="tref internalDFN" title="iri" href="#dfn-iri">
<abbr title="Internationalized Resource Identifier">
IRI
</abbr>
<del class="diff-old">is
not
allowed,
and
if
requested,
must
result
in
this
exception.
</del>
</a>.
</td>
</tr>
</table>
<div>
<em>
Return
type:
</em>
<code>
<a>
<del class="diff-old">object
</del>
<ins class="diff-chg">void
</ins>
</a>
</code>
</div>
</dd>
<dt id="widl-JsonLdProcessor-fromRDF-void-StatementArray-input-JsonLdCallback-callback-JsonLdOptions-options">
<code>
<del class="diff-old">normalize
</del>
<ins class="diff-chg">fromRDF
</ins>
</code>
</dt>
<dd>
<del class="diff-old">Normalizes
the
</del>
<ins class="diff-chg">Creates
a
JSON-LD
document
</ins>
given
<ins class="diff-new">an
set
of
</ins><a href="#idl-def-Statement" class="idlType">
<code>
<del class="diff-old">input
according
to
the
steps
in
the
Normalization
Algorithm
.
The
input
must
be
copied,
normalized
and
returned
if
there
are
no
errors.
If
the
compaction
fails,
null
</del>
<ins class="diff-chg">Statement
</ins>
</code>
<del class="diff-old">must
be
returned.
The
output
is
the
serialized
representation
returned
from
the
Normalization
Algorithm
.
It's
still
an
open
question
if
the
result
is
a
DOMString
representing
the
serialized
graph
in
JSON-LD,
or
an
array
</del>
</a>
<del class="diff-old">representation
which
is
in
normalized
form.
</del>
<ins class="diff-chg">s.
</ins>
<table class="parameters">
<tr>
<th>
Parameter
</th>
<th>
Type
</th>
<th>
Nullable
</th>
<th>
Optional
</th>
<th>
Description
</th>
</tr>
<tr>
<td class="prmName">
input
</td>
<td class="prmType">
<code>
<del class="diff-old">object
</del>
<a href="#idl-def-Statement" class="idlType">
<code>
<ins class="diff-new">Statement
</ins></code></a><ins class="diff-new">
[]
</ins>
</code>
</td>
<td class="prmNullFalse">
✘
</td>
<td class="prmOptFalse">
✘
</td>
<td class="prmDesc">
<del class="diff-old">The
JSON-LD
object
to
perform
normalization
upon.
</del>
<ins class="diff-chg">An
array
of
RDF
statements.
</ins>
</td>
</tr>
<tr>
<td class="prmName">
<del class="diff-old">context
</del>
<ins class="diff-chg">callback
</ins>
</td>
<td class="prmType">
<code>
<del class="diff-old">object
</del>
<a href="#idl-def-JsonLdCallback" class="idlType">
<code>
<ins class="diff-chg">JsonLdCallback
</ins></code>
</a>
</code>
</td>
<del class="diff-old">✔
</del>
<td class="prmNullFalse">
<ins class="diff-chg">✘
</ins>
</td>
<del class="diff-old">✔
</del>
<td class="prmOptFalse">
<ins class="diff-chg">✘
</ins>
</td>
<td class="prmDesc">
<del class="diff-old">An
external
context
to
use
additionally
to
the
context
embedded
in
input
</del>
<ins class="diff-chg">A
callback
that
is
called
</ins>
when
<del class="diff-old">expanding
</del>
<ins class="diff-chg">processing
is
complete
on
</ins>
the
<ins class="diff-new">given
</ins>
<code>
input
</code>.
</td>
</tr>
<tr>
<del class="diff-old">Exception
</del>
<td class="prmName">
<ins class="diff-chg">options
</ins></td>
<del class="diff-old">Description
</del>
<td class="prmType">
<code>
<a href="#idl-def-JsonLdOptions" class="idlType">
<code>
<ins class="diff-chg">JsonLdOptions
</ins></code>
<del class="diff-old">InvalidContext
</del>
</a>
</code>
</td>
<del class="diff-old">INVALID_SYNTAX
</del>
<td class="prmNullFalse">
<ins class="diff-chg">✘
</ins></td>
<td class="prmOptTrue">
<ins class="diff-new">✔
</ins>
</td>
<td class="prmDesc">
A
<del class="diff-old">general
syntax
error
was
detected
in
</del>
<ins class="diff-chg">set
of
options
that
will
affect
</ins>
the
<ins class="diff-new">algorithm.
This
includes
</ins>
<code>
<del class="diff-old">@context
.
For
example,
</del>
<ins class="diff-chg">notType
</ins></code>,<ins class="diff-chg">
which
</ins>
if
<del class="diff-old">a
@type
key
maps
</del>
<ins class="diff-chg">set
</ins>
to
<del class="diff-old">anything
other
than
@id
or
an
absolute
IRI
,
this
exception
would
be
raised.
</del>
<a class="tref internalDFN" title="true" href="#dfn-true">
<ins class="diff-chg">true
</ins></a><ins class="diff-chg">
causes
the
resulting
document
to
use
</ins>
<code>
<del class="diff-old">LOAD_ERROR
</del>
<ins class="diff-chg">rdf:type
</ins>
</code>
<del class="diff-old">There
was
a
problem
encountered
loading
</del>
<ins class="diff-chg">as
</ins>
a
<del class="diff-old">remote
context.
</del>
<ins class="diff-chg">property,
instead
of
</ins><code><ins class="diff-chg">
@type
</ins></code>.
</td>
</tr>
</table>
<div>
<em>
Return
type:
</em>
<code>
<a>
<del class="diff-old">DOMString
</del>
<ins class="diff-chg">void
</ins>
</a>
</code>
</div>
</dd>
<dt id="widl-JsonLdProcessor-toRDF-void-object-or-object---or-URL-input-ObjectOrURL-context-StatementCallback-callback-JsonLdOptions-options">
<code>
<del class="diff-old">triples
</del>
<ins class="diff-chg">toRDF
</ins>
</code>
</dt>
<dd>
Processes
the
<code>
input
</code>
according
to
the
<a href="#convert-to-rdf-algorithm">
<ins class="diff-chg">Convert
to
</ins>
RDF
<del class="diff-old">Conversion
</del>
Algorithm
</a>,
calling
the
provided
<code>
<del class="diff-old">tripleCallback
</del>
<ins class="diff-chg">callback
</ins>
</code>
for
each
<del class="diff-old">triple
</del>
<a href="#idl-def-Statement" class="idlType">
<code>
<ins class="diff-chg">Statement
</ins></code></a>
generated.
<table class="parameters">
<tr>
<th>
Parameter
</th>
<th>
Type
</th>
<th>
Nullable
</th>
<th>
Optional
</th>
<th>
Description
</th>
</tr>
<tr>
<td class="prmName">
input
</td>
<td class="prmType">
<code>
<a>
object
<ins class="diff-new">or
object[]
or
URL
</ins>
</a>
</code>
</td>
<td class="prmNullFalse">
✘
</td>
<td class="prmOptFalse">
✘
</td>
<td class="prmDesc">
The
JSON-LD
object
<ins class="diff-new">or
array
of
JSON-LD
objects
</ins>
to
<del class="diff-old">process
</del>
<ins class="diff-chg">convert
to
RDF
or
an
</ins><a class="tref internalDFN" title="iri" href="#dfn-iri"><abbr title="Internationalized Resource Identifier"><ins class="diff-chg">
IRI
</ins></abbr></a><ins class="diff-chg">
referencing
the
JSON-LD
document
to
convert
to
RDF.
</ins></td></tr><tr><td class="prmName"><ins class="diff-chg">
context
</ins></td><td class="prmType"><code><a><ins class="diff-chg">
ObjectOrURL
</ins></a></code></td><td class="prmNullTrue"><ins class="diff-chg">
✔
</ins></td><td class="prmOptFalse"><ins class="diff-chg">
✘
</ins></td><td class="prmDesc"><ins class="diff-chg">
An
external
context
to
use
additionally
to
the
context
embedded
in
</ins><code><ins class="diff-chg">
input
</ins></code>
when
<del class="diff-old">outputting
triples.
</del>
<ins class="diff-chg">expanding
the
</ins><code><ins class="diff-chg">
input
</ins></code>.
</td>
</tr>
<tr>
<td class="prmName">
<del class="diff-old">tripleCallback
</del>
<ins class="diff-chg">callback
</ins>
</td>
<td class="prmType">
<code>
<a href="#idl-def-StatementCallback" class="idlType">
<code>
<del class="diff-old">JsonLdTripleCallback
</del>
<ins class="diff-chg">StatementCallback
</ins>
</code>
</a>
</code>
</td>
<td class="prmNullFalse">
✘
</td>
<td class="prmOptFalse">
✘
</td>
<td class="prmDesc">
A
callback
that
is
called
<del class="diff-old">whenever
</del>
<ins class="diff-chg">when
</ins>
a
<a href="#idl-def-Statement" class="idlType">
<code>
<ins class="diff-new">Statement
</ins></code></a><ins class="diff-new">
is
created
from
</ins>
processing
<del class="diff-old">error
occurs
on
</del>
the
given
<code>
input
</code>.
<del class="diff-old">This
callback
should
be
aligned
with
the
RDF
API.
</del>
</td>
</tr>
<tr>
<td class="prmName">
<del class="diff-old">context
</del>
<ins class="diff-chg">options
</ins>
</td>
<td class="prmType">
<code>
<del class="diff-old">object
</del>
<a href="#idl-def-JsonLdOptions" class="idlType">
<code>
<ins class="diff-chg">JsonLdOptions
</ins></code>
</a>
</code>
</td>
<del class="diff-old">✔
</del>
<td class="prmNullFalse">
<ins class="diff-chg">✘
</ins>
</td>
<td class="prmOptTrue">
✔
</td>
<td class="prmDesc">
<del class="diff-old">An
external
context
to
use
additionally
to
</del>
<ins class="diff-chg">A
set
of
options
that
</ins><em class="rfc2119" title="may"><ins class="diff-chg">
may
</ins></em><ins class="diff-chg">
affect
</ins>
the
<del class="diff-old">context
embedded
in
input
when
expanding
</del>
<ins class="diff-chg">conversion
to
RDF
such
as,
e.g.,
</ins>
the
input
<del class="diff-old">.
</del>
<ins class="diff-chg">document's
base
</ins><a class="tref internalDFN" title="iri" href="#dfn-iri"><abbr title="Internationalized Resource Identifier"><ins class="diff-chg">
IRI
</ins></abbr></a>.
</td>
</tr>
</table>
<del class="diff-old">Exception
Description
</del>
<div>
<em>
<ins class="diff-chg">Return
type:
</ins></em>
<code>
<a>
<del class="diff-old">InvalidContext
</del>
<ins class="diff-chg">void
</ins>
</a>
</code>
</div>
</dd>
</dl>
</div>
</div>
<div id="callbacks" class="section">
<h3>
<del class="diff-old">INVALID_SYNTAX
</del>
<span class="secno">
<ins class="diff-chg">2.2
</ins></span><ins class="diff-chg">
Callbacks
</ins></h3><div id="jsonldcallback" class="section"><h4>
<span class="secno">
<ins class="diff-chg">2.2.1
</ins></span><ins class="diff-chg">
JsonLdCallback
</ins></h4><p><ins class="diff-chg">
The
</ins><a href="#idl-def-JsonLdCallback" class="idlType">
<del class="diff-old">A
general
syntax
error
was
detected
in
the
</del>
<code>
<del class="diff-old">@context
.
For
example,
if
a
@type
</del>
<ins class="diff-chg">JsonLdCallback
</ins>
</code>
<del class="diff-old">key
maps
</del>
</a>
<ins class="diff-chg">is
used
</ins>
to
<del class="diff-old">anything
other
than
</del>
<ins class="diff-chg">return
a
processed
JSON-LD
representation
as
the
result
of
processing
an
API
method.
</ins></p>    <pre class="idl"><span id="idl-def-JsonLdCallback" class="idlInterface">[<span class="extAttr">NoInterfaceObject Callback</span>]<ins class="diff-chg">
interface <span class="idlInterfaceID">JsonLdCallback</span> {
</ins><span class="idlMethod">    <span class="idlMethType"><a>void</a></span> <span class="idlMethName"><a href="#widl-JsonLdCallback-jsonLd-void-ObjectOrObjectArray-jsonld">jsonLd</a></span> (<span class="idlParam"><span class="idlParamType"><a>ObjectOrObjectArray</a></span> <span class="idlParamName">jsonld</span></span>);</span><ins class="diff-chg">
};</span>
</ins></pre><div id="methods-1" class="section"><h5><span class="secno"><ins class="diff-chg">
2.2.1.1
</ins></span><ins class="diff-chg">
Methods
</ins></h5><dl class="methods"><dt id="widl-JsonLdCallback-jsonLd-void-ObjectOrObjectArray-jsonld">
<code>
<del class="diff-old">@id
</del>
<ins class="diff-chg">jsonLd
</ins>
</code>
<del class="diff-old">or
an
absolute
IRI
,
this
exception
would
be
raised.
</del>
</dt>
<dd>
<ins class="diff-chg">This
callback
is
invoked
when
processing
is
complete.
</ins><table class="parameters"><tr><th><ins class="diff-chg">
Parameter
</ins></th><th><ins class="diff-chg">
Type
</ins></th><th><ins class="diff-chg">
Nullable
</ins></th><th><ins class="diff-chg">
Optional
</ins></th><th><ins class="diff-chg">
Description
</ins></th>
</tr>
<tr>
<td class="prmName">
<ins class="diff-chg">jsonld
</ins></td><td class="prmType">
<code>
<del class="diff-old">LOAD_ERROR
</del>
<a>
<ins class="diff-chg">ObjectOrObjectArray
</ins></a>
</code>
</td>
<del class="diff-old">There
was
a
problem
encountered
loading
a
remote
context.
</del>
<td class="prmNullFalse">
<ins class="diff-chg">✘
</ins>
</td>
<td class="prmOptFalse">
<ins class="diff-chg">✘
</ins></td>
<td class="prmDesc">
<ins class="diff-new">The
processed
JSON-LD
document.
</ins>
</td>
</tr>
</table>
<div>
<em>
Return
type:
</em>
<code>
<a>
void
</a>
</code>
</div>
</dd>
</dl>
</div>
</div>
<div id="statementcallback" class="section">
<h4>
<span class="secno">
<del class="diff-old">2.2
</del>
<ins class="diff-chg">2.2.2
</ins>
</span>
<del class="diff-old">JsonLdTripleCallback
</del>
<ins class="diff-chg">StatementCallback
</ins></h4>
<p>
The
<del class="diff-old">JsonLdTripleCallback
</del>
<a href="#idl-def-StatementCallback" class="idlType">
<code>
<ins class="diff-chg">StatementCallback
</ins></code></a>
is
called
whenever
the
processor
generates
a
<del class="diff-old">triple
</del>
<ins class="diff-chg">statement
</ins>
during
the
<code>
<del class="diff-old">triple()
</del>
<ins class="diff-chg">statement()
</ins>
</code>
call.
</p>
<del class="diff-old">    ]
interface  {
</del>
    <pre class="idl"><span id="idl-def-StatementCallback" class="idlInterface">[<span class="extAttr">NoInterfaceObject Callback</span>]
<ins class="diff-chg">interface <span class="idlInterfaceID">StatementCallback</span> {
</ins><span class="idlMethod">    <span class="idlMethType"><a>void</a></span> <span class="idlMethName"><a href="#widl-StatementCallback-statement-void-Statement-statement">statement</a></span> (<span class="idlParam"><span class="idlParamType"><a href="#idl-def-Statement" class="idlType"><code>Statement</code></a></span> <span class="idlParamName">statement</span></span>);</span>
};</span>
</pre>
<div id="methods-2" class="section">
<h5>
<span class="secno">
<del class="diff-old">2.2.1
</del>
<ins class="diff-chg">2.2.2.1
</ins>
</span>
Methods
</h5>
<dl class="methods">
<dt id="widl-StatementCallback-statement-void-Statement-statement">
<code>
<del class="diff-old">triple
</del>
<ins class="diff-chg">statement
</ins>
</code>
</dt>
<dd>
This
callback
is
invoked
whenever
a
<del class="diff-old">triple
</del>
<ins class="diff-chg">statement
</ins>
is
generated
by
the
processor.
<table class="parameters">
<tr>
<th>
Parameter
</th>
<th>
Type
</th>
<th>
Nullable
</th>
<th>
Optional
</th>
<th>
Description
</th>
</tr>
<tr>
<td class="prmName">
<del class="diff-old">subject
</del>
<ins class="diff-chg">statement
</ins>
</td>
<td class="prmType">
<code>
<del class="diff-old">DOMString
</del>
<a href="#idl-def-Statement" class="idlType">
<code>
<ins class="diff-chg">Statement
</ins></code>
</a>
</code>
</td>
<td class="prmNullFalse">
✘
</td>
<td class="prmOptFalse">
✘
</td>
<td class="prmDesc">
The
<del class="diff-old">subject
IRI
that
is
associated
with
the
triple.
</del>
<ins class="diff-chg">statement.
</ins>
</td>
</tr>
</table>
<del class="diff-old">property
</del>
<div>
<em>
<ins class="diff-chg">Return
type:
</ins></em>
<code>
<a>
<del class="diff-old">DOMString
</del>
<ins class="diff-chg">void
</ins>
</a>
</code>
</div>
<del class="diff-old">✘
</del>
</dd>
<del class="diff-old">✘
</del>
</dl>
</div>
</div>
</div>
<div id="data-structures" class="section">
<h3>
<span class="secno">
<ins class="diff-chg">2.3
</ins></span><ins class="diff-chg">
Data
Structures
</ins></h3><p><ins class="diff-chg">
This
section
describes
datatype
definitions
used
within
the
JSON-LD
API.
</ins></p><div id="url" class="section"><h4><span class="secno"><ins class="diff-chg">
2.3.1
</ins></span><ins class="diff-chg">
URL
</ins></h4><p>
The
<del class="diff-old">property
</del>
<a href="#idl-def-URL" class="idlType">
<code>
<ins class="diff-chg">URL
</ins></code></a><ins class="diff-chg">
datatype
is
a
string
representation
of
an
</ins><a class="tref internalDFN" title="iri" href="#dfn-iri">
<abbr title="Internationalized Resource Identifier">
IRI
</abbr>
</a>.
</p>
<pre class="idl">
<span id="idl-def-URL" class="idlTypedef">
<ins class="diff-new">typedef
</ins><span class="idlTypedefType"><a><ins class="diff-new">
DOMString
</ins></a></span><span class="idlTypedefID"><ins class="diff-new">
URL
</ins></span><ins class="diff-new">
;
</ins></span></pre><div class="idlTypedefDesc"><ins class="diff-new">
This
datatype
indicates
</ins>
that
<del class="diff-old">is
associated
with
</del>
the
<del class="diff-old">triple.
</del>
<a class="tref internalDFN" title="iri" href="#dfn-iri">
<abbr title="Internationalized Resource Identifier">
<ins class="diff-chg">IRI
</ins></abbr>
</a>
<ins class="diff-chg">is
interpreted
as
a
Universal
Resource
Locator
identifying
a
document,
which
when
parsed
as
JSON
yields
either
a
</ins><code><ins class="diff-chg">
JSON
object
</ins></code><ins class="diff-chg">
or
</ins><code><ins class="diff-chg">
array
</ins></code>.</div></div><div id="jsonldoptions" class="section"><h4>
<del class="diff-old">objectType
</del>
<span class="secno">
<ins class="diff-chg">2.3.2
</ins></span><ins class="diff-chg">
JsonLdOptions
</ins></h4><p><ins class="diff-chg">
The
</ins><a><ins class="diff-chg">
JsonLdOptiones
</ins></a><ins class="diff-chg">
type
is
used
to
convery
a
set
of
options
to
an
interface
method.
</ins></p><pre class="idl">
<span id="idl-def-JsonLdOptions" class="idlTypedef">
<ins class="diff-chg">typedef
</ins><span class="idlTypedefType"><a><ins class="diff-chg">
object
</ins></a></span><span class="idlTypedefID"><ins class="diff-chg">
JsonLdOptions
</ins></span><ins class="diff-chg">
;
</ins></span></pre><div class="idlTypedefDesc"><dt><a href="#idl-def-URL" class="idlType"><code><ins class="diff-chg">
URL
</ins></code></a><ins class="diff-chg">
base
</ins></dt><dd><ins class="diff-chg">
The
Base
</ins><abbr title="Internationalized Resource Identifier"><ins class="diff-chg">
IRI
</ins></abbr><ins class="diff-chg">
to
use
when
expanding
the
document.
This
overrides
the
value
of
</ins><em><ins class="diff-chg">
input
</ins></em><ins class="diff-chg">
if
it
is
a
</ins><a href="#idl-def-URL" class="idlType">
<code>
<ins class="diff-new">URL
</ins></code>
</a>
<ins class="diff-new">or
if
it
is
a
</ins><code><ins class="diff-new">
object
</ins></code><ins class="diff-new">
or
</ins><code><ins class="diff-new">
object[]
</ins></code>.</dd><dt><ins class="diff-new">
boolean
optimize
</ins></dt><dd><ins class="diff-new">
If
set
to
</ins><code><ins class="diff-new">
true
</ins></code>,<ins class="diff-new">
the
JSON-LD
processor
is
allowed
to
optimize
the
output
of
the
</ins><a href="#compaction-algorithm"><ins class="diff-new">
Compaction
Algorithm
</ins></a><ins class="diff-new">
to
produce
even
compacter
representations.
The
algorithm
for
compaction
optimization
is
beyond
the
scope
of
this
specification
and
thus
not
defined.
Consequently,
different
implementations
</ins><em class="rfc2119" title="may"><ins class="diff-new">
may
</ins></em><ins class="diff-new">
implement
different
optimization
algorithms.
</ins></dd><dt><ins class="diff-new">
boolean
noType
</ins></dt><dd><ins class="diff-new">
If
set
to
</ins><code><ins class="diff-new">
true
</ins></code>,<ins class="diff-new">
the
JSON-LD
processor
will
not
use
the
</ins><code><ins class="diff-new">
@type
</ins></code><ins class="diff-new">
property
when
generating
the
output,
and
will
use
the
expanded
</ins><code><ins class="diff-new">
rdf:type
</ins></code><abbr title="Internationalized Resource Identifier"><ins class="diff-new">
IRI
</ins></abbr><ins class="diff-new">
as
the
property
instead
of
</ins><code><ins class="diff-new">
@type
</ins></code>.</dd></div></div><p><ins class="diff-new">
The
following
data
structures
are
used
for
representing
data
about
RDF
statements
(triples
or
quads).
They
are
used
for
normalization,
</ins>
<a>
<del class="diff-old">DOMString
</del>
<ins class="diff-chg">fromRDF
</ins></a>,<ins class="diff-chg">
and
from
</ins><a><ins class="diff-chg">
toRDF
</ins>
</a>
<ins class="diff-new">interfaces.
</ins></p><div id="statement" class="section"><h4>
<span class="secno">
<ins class="diff-new">2.3.3
</ins></span><ins class="diff-new">
Statement
</ins></h4><p><ins class="diff-new">
The
</ins><a href="#idl-def-Statement" class="idlType"><code><ins class="diff-new">
Statement
</ins>
</code>
</a>
<ins class="diff-chg">interface
represents
an
RDF
Statement.
</ins></p>    <pre class="idl"><span id="idl-def-Statement" class="idlInterface">[<span class="extAttr">NoInterfaceObject</span>]<ins class="diff-chg">
interface <span class="idlInterfaceID">Statement</span> {
</ins><span class="idlAttribute">    readonly attribute <span class="idlAttrType"><a href="#idl-def-Node" class="idlType"><code>Node</code></a></span>  <span class="idlAttrName"><a href="#widl-Statement-subject">subject</a></span>;</span><span class="idlAttribute">    readonly attribute <span class="idlAttrType"><a href="#idl-def-Node" class="idlType"><code>Node</code></a></span>  <span class="idlAttrName"><a href="#widl-Statement-property">property</a></span>;</span><span class="idlAttribute">    readonly attribute <span class="idlAttrType"><a href="#idl-def-Node" class="idlType"><code>Node</code></a></span>  <span class="idlAttrName"><a href="#widl-Statement-object">object</a></span>;</span><span class="idlAttribute">    readonly attribute <span class="idlAttrType"><a href="#idl-def-Node" class="idlType"><code>Node</code></a>?</span> <span class="idlAttrName"><a href="#widl-Statement-name">name</a></span>;</span><ins class="diff-chg">
};</span>
</ins></pre>
<del class="diff-old">✘
</del>
<div id="attributes" class="section">
<del class="diff-old">✘
</del>
<h5>
<del class="diff-old">The
</del>
<span class="secno">
<ins class="diff-chg">2.3.3.1
</ins></span><ins class="diff-chg">
Attributes
</ins></h5><dl class="attributes"><dt id="widl-Statement-name"><code><ins class="diff-chg">
name
</ins></code><ins class="diff-chg">
of
</ins>
type
<span class="idlAttrType">
<a href="#idl-def-Node" class="idlType">
<code>
<ins class="diff-new">Node
</ins></code></a></span>,<ins class="diff-new">
readonly,
nullable
</ins></dt><dd><ins class="diff-new">
The
name
associated
with
the
</ins><a href="#idl-def-Statement" class="idlType"><code><ins class="diff-new">
Statement
</ins></code></a><ins class="diff-new">
identifying
it
as
a
member
</ins>
of
<del class="diff-old">object
</del>
<ins class="diff-chg">a
named
graph.
If
the
attribute
is
present,
it
indicates
</ins>
that
<ins class="diff-new">this
statement
</ins>
is
<ins class="diff-new">a
member
of
a
</ins><em><ins class="diff-new">
named
graph
</ins></em>
associated
with
<em>
<ins class="diff-new">name
</ins></em>.<ins class="diff-new">
If
it
is
missing,
</ins>
the
<del class="diff-old">triple.
Valid
values
are
</del>
<ins class="diff-chg">statement
is
a
member
of
the
</ins><em><ins class="diff-chg">
default
graph
</ins></em>.</dd>
<del class="diff-old">IRI
</del>
<dt id="widl-Statement-object">
<code>
<ins class="diff-new">object
</ins>
</code>
<del class="diff-old">and
</del>
<ins class="diff-chg">of
type
</ins><span class="idlAttrType"><a href="#idl-def-Node" class="idlType">
<code>
<del class="diff-old">literal
.
</del>
<ins class="diff-chg">Node
</ins></code>
</a>
</span>,
<ins class="diff-chg">readonly
</ins></dt>
<dd>
<ins class="diff-chg">The
</ins>
object
<ins class="diff-chg">associated
with
the
</ins><a href="#idl-def-Statement" class="idlType">
<code>
<ins class="diff-chg">Statement
</ins></code></a>.</dd><dt id="widl-Statement-property">
<code>
<ins class="diff-new">property
</ins></code><ins class="diff-new">
of
type
</ins><span class="idlAttrType"><a href="#idl-def-Node" class="idlType"><code><ins class="diff-new">
Node
</ins></code>
<del class="diff-old">DOMString
</del>
</a>
</span>,
<ins class="diff-new">readonly
</ins></dt><dd><ins class="diff-new">
The
property
associated
with
the
</ins><a href="#idl-def-Statement" class="idlType"><code><ins class="diff-new">
Statement
</ins>
</code>
</a>.
</dd>
<del class="diff-old">✘
</del>
<dt id="widl-Statement-subject">
<del class="diff-old">✘
</del>
<code>
<ins class="diff-chg">subject
</ins></code><ins class="diff-chg">
of
type
</ins><span class="idlAttrType">
<a href="#idl-def-Node" class="idlType">
<code>
<ins class="diff-chg">Node
</ins></code></a></span>,<ins class="diff-chg">
readonly
</ins></dt><dd>
The
<del class="diff-old">object
value
</del>
<ins class="diff-chg">subject
</ins>
associated
with
the
<del class="diff-old">subject
</del>
<a href="#idl-def-Statement" class="idlType">
<code>
<ins class="diff-chg">Statement
</ins></code></a>.</dd></dl></div></div><div id="node" class="section"><h4><span class="secno"><ins class="diff-chg">
2.3.4
</ins></span><ins class="diff-chg">
Node
</ins></h4><p><a href="#idl-def-Node" class="idlType"><code><ins class="diff-chg">
Node
</ins></code></a><ins class="diff-chg">
is
the
base
class
of
</ins><a href="#idl-def-NamedNode" class="idlType"><code><ins class="diff-chg">
NamedNode
</ins></code></a>,<a href="#idl-def-BlankNode" class="idlType"><code><ins class="diff-chg">
BlankNode
</ins></code></a>,
and
<a href="#idl-def-LiteralNode" class="idlType">
<code>
<ins class="diff-new">LiteralNode
</ins></code></a>.</p>    <pre class="idl"><span id="idl-def-Node" class="idlInterface">[<span class="extAttr">NoInterfaceObject</span>]<ins class="diff-new">
interface <span class="idlInterfaceID">Node</span> {
</ins><span class="idlAttribute">    readonly attribute <span class="idlAttrType"><a>DOMString</a></span> <span class="idlAttrName"><a href="#widl-Node-nominalValue">nominalValue</a></span>;</span><span class="idlAttribute">    readonly attribute <span class="idlAttrType"><a>DOMString</a></span> <span class="idlAttrName"><a href="#widl-Node-interfaceName">interfaceName</a></span>;</span><ins class="diff-new">
};</span>
</ins></pre><div id="attributes-1" class="section"><h5><span class="secno"><ins class="diff-new">
2.3.4.1
</ins></span><ins class="diff-new">
Attributes
</ins></h5><dl class="attributes"><dt id="widl-Node-interfaceName"><code><ins class="diff-new">
interfaceName
</ins></code><ins class="diff-new">
of
type
</ins><span class="idlAttrType"><a><ins class="diff-new">
DOMString
</ins></a></span>,<ins class="diff-new">
readonly
</ins></dt><dd><p><ins class="diff-new">
Provides
access
to
</ins>
the
<del class="diff-old">property.
</del>
<ins class="diff-chg">string
name
of
the
current
interface,
normally
one
of
</ins><code><ins class="diff-chg">
&quot;
</ins><abbr title="Internationalized Resource Identifier"><ins class="diff-chg">
IRI
</ins></abbr><ins class="diff-chg">
&quot;
</ins></code>,<code><ins class="diff-chg">
&quot;BlankNode&quot;
</ins></code><ins class="diff-chg">
or
</ins><code><ins class="diff-chg">
&quot;LiteralNode&quot;
</ins></code>.</p><p><ins class="diff-chg">
This
method
serves
to
disambiguate
instances
of
</ins><a href="#idl-def-Node" class="idlType">
<code>
<ins class="diff-chg">Node
</ins></code>
</a>
<ins class="diff-chg">which
are
otherwise
identical,
such
as
</ins><a href="#idl-def-NamedNode" class="idlType">
<del class="diff-old">datatype
</del>
<code>
<ins class="diff-chg">NamedNode
</ins></code>
</a>
<ins class="diff-chg">and
</ins><a href="#idl-def-BlankNode" class="idlType">
<code>
<ins class="diff-new">BlankNode
</ins></code></a>.</p></dd><dt id="widl-Node-nominalValue"><code><ins class="diff-new">
nominalValue
</ins></code><ins class="diff-new">
of
type
</ins><span class="idlAttrType">
<a>
DOMString
</a>
</span>,
<ins class="diff-new">readonly
</ins></dt><dd><p><ins class="diff-new">
The
</ins><code><ins class="diff-new">
nominalValue
</ins>
</code>
<ins class="diff-new">of
an
</ins><a href="#idl-def-Node" class="idlType">
<code>
<ins class="diff-chg">Node
</ins></code>
<del class="diff-old">✔
</del>
</a>
<ins class="diff-chg">is
refined
by
each
interface
which
extends
</ins><a href="#idl-def-Node" class="idlType">
<del class="diff-old">✘
</del>
<code>
<ins class="diff-chg">Node
</ins></code>
</a>.
</p>
</dd>
</dl>
</div>
</div>
<div id="namednode" class="section">
<h4>
<span class="secno">
<ins class="diff-chg">2.3.5
</ins></span><ins class="diff-chg">
NamedNode
</ins></h4><p><ins class="diff-chg">
A
node
identified
by
an
</ins><a class="tref internalDFN" title="iri" href="#dfn-iri"><abbr title="Internationalized Resource Identifier"><ins class="diff-chg">
IRI
</ins></abbr></a>.<ins class="diff-chg">
NamedNodes
are
defined
by
International
Resource
Identifier
[
</ins><cite><a class="bibref" rel="biblioentry" href="#bib-IRI"><ins class="diff-chg">
IRI
</ins></a></cite><ins class="diff-chg">
].
</ins></p>    <pre class="idl"><span id="idl-def-NamedNode" class="idlInterface">[<span class="extAttr">NoInterfaceObject</span>]<ins class="diff-chg">
interface <span class="idlInterfaceID">NamedNode</span> : <span class="idlSuperclass"><a href="#idl-def-Node" class="idlType"><code>Node</code></a></span> {
</ins><span class="idlAttribute">    readonly attribute <span class="idlAttrType"><a>DOMString</a></span> <span class="idlAttrName"><a href="#widl-NamedNode-nominalValue">nominalValue</a></span>;</span><ins class="diff-chg">
};</span>
</ins></pre><div id="attributes-2" class="section"><h5><span class="secno"><ins class="diff-chg">
2.3.5.1
</ins></span><ins class="diff-chg">
Attributes
</ins></h5><dl class="attributes"><dt id="widl-NamedNode-nominalValue"><code><ins class="diff-chg">
nominalValue
</ins></code><ins class="diff-chg">
of
type
</ins><span class="idlAttrType"><a><ins class="diff-chg">
DOMString
</ins></a></span>,<ins class="diff-chg">
readonly
</ins></dt><dd>
The
<del class="diff-old">datatype
associated
with
</del>
<abbr title="Internationalized Resource Identifier">
<ins class="diff-chg">IRI
</ins></abbr><ins class="diff-chg">
identifier
of
</ins>
the
<del class="diff-old">object.
</del>
<ins class="diff-chg">node.
</ins></dd>
</dl>
</div>
</div>
<div id="blank-node" class="section">
<h4>
<del class="diff-old">language
</del>
<span class="secno">
<ins class="diff-chg">2.3.6
</ins></span><ins class="diff-chg">
Blank
Node
</ins></h4><p><ins class="diff-chg">
A
</ins><a href="#idl-def-BlankNode" class="idlType">
<code>
<ins class="diff-chg">BlankNode
</ins></code></a><ins class="diff-chg">
is
a
reference
to
an
unnamed
resource
(one
for
which
an
</ins><abbr title="Internationalized Resource Identifier"><ins class="diff-chg">
IRI
</ins></abbr><ins class="diff-chg">
is
not
known),
and
may
be
used
in
a
</ins><a href="#idl-def-Statement" class="idlType"><code><ins class="diff-chg">
Statement
</ins></code></a><ins class="diff-chg">
as
a
unique
reference
to
that
unnamed
resource.
</ins></p>    <pre class="idl"><span id="idl-def-BlankNode" class="idlInterface">[<span class="extAttr">NoInterfaceObject</span>]<ins class="diff-chg">
interface <span class="idlInterfaceID">BlankNode</span> : <span class="idlSuperclass"><a href="#idl-def-Node" class="idlType"><code>Node</code></a></span> {
</ins><span class="idlAttribute">    readonly attribute <span class="idlAttrType"><a>DOMString</a></span> <span class="idlAttrName"><a href="#widl-BlankNode-nominalValue">nominalValue</a></span>;</span><ins class="diff-chg">
};</span>
</ins></pre><div id="attributes-3" class="section"><h5><span class="secno"><ins class="diff-chg">
2.3.6.1
</ins></span><ins class="diff-chg">
Attributes
</ins></h5><dl class="attributes"><dt id="widl-BlankNode-nominalValue">
<code>
<ins class="diff-new">nominalValue
</ins></code><ins class="diff-new">
of
type
</ins><span class="idlAttrType">
<a>
DOMString
</a>
</span>,
<ins class="diff-new">readonly
</ins></dt><dd><ins class="diff-new">
The
temporary
identifier
of
the
</ins><a href="#idl-def-BlankNode" class="idlType"><code><ins class="diff-new">
BlankNode
</ins>
</code>
</a>.
<ins class="diff-chg">The
nominalValue
</ins><em class="rfc2119" title="must not"><ins class="diff-chg">
must
not
</ins></em><ins class="diff-chg">
be
relied
upon
in
any
way
between
two
separate
processing
runs
of
the
same
document.
</ins></dd>
<del class="diff-old">✔
</del>
</dl>
<del class="diff-old">✘
</del>
</div>
<p class="note">
<ins class="diff-chg">Developers
and
authors
must
not
assume
that
the
nominalValue
of
a
</ins><a href="#idl-def-BlankNode" class="idlType">
<del class="diff-old">The
</del>
<code>
<ins class="diff-chg">BlankNode
</ins></code></a><ins class="diff-chg">
will
remain
the
same
between
two
processing
runs.
</ins><a href="#idl-def-BlankNode" class="idlType"><code><ins class="diff-chg">
BlankNode
</ins></code></a><ins class="diff-chg">
nominalValues
are
only
valid
for
the
most
recent
processing
run
on
the
document.
</ins><a href="#idl-def-BlankNode" class="idlType"><code><ins class="diff-chg">
BlankNode
</ins></code></a><ins class="diff-chg">
s
nominalValues
will
often
be
generated
differently
by
different
processors.
</ins></p><p class="note"><ins class="diff-chg">
Implementers
</ins><em class="rfc2119" title="must"><ins class="diff-chg">
must
</ins></em><ins class="diff-chg">
ensure
that
</ins><a href="#idl-def-BlankNode" class="idlType"><code><ins class="diff-chg">
BlankNode
</ins></code></a><ins class="diff-chg">
nominalValues
are
unique
within
the
current
environment,
two
</ins><a href="#idl-def-BlankNode" class="idlType"><code><ins class="diff-chg">
BlankNode
</ins></code></a><ins class="diff-chg">
s
are
considered
equal
if,
and
only
if,
their
nominalValues
are
strictly
equal.
</ins></p></div><div id="literalnode" class="section"><h4><span class="secno"><ins class="diff-chg">
2.3.7
</ins></span><ins class="diff-chg">
LiteralNode
</ins></h4><p><ins class="diff-chg">
LiteralNodes
represent
values
such
as
numbers,
dates
and
strings
in
RDF
data.
A
</ins><a href="#idl-def-LiteralNode" class="idlType"><code><ins class="diff-chg">
LiteralNode
</ins></code></a><ins class="diff-chg">
is
comprised
of
three
attributes:
</ins></p><ul><li><ins class="diff-chg">
a
lexical
representation
of
the
</ins><code><ins class="diff-chg">
nominalValue
</ins></code></li><li><ins class="diff-chg">
an
optional
</ins><code>
language
<del class="diff-old">associated
</del>
</code>
<ins class="diff-chg">represented
by
a
string
token
</ins></li><li><ins class="diff-chg">
an
optional
</ins><code><ins class="diff-chg">
datatype
</ins></code><ins class="diff-chg">
specified
by
a
</ins><a href="#idl-def-NamedNode" class="idlType"><code><ins class="diff-chg">
NamedNode
</ins></code></a></li></ul><p><ins class="diff-chg">
LiteralNodes
representing
plain
text
in
a
natural
language
may
have
a
</ins><code><ins class="diff-chg">
language
</ins></code><ins class="diff-chg">
attribute
specified
by
a
text
string
token,
as
specified
in
[
</ins><cite><a class="bibref" rel="biblioentry" href="#bib-BCP47"><ins class="diff-chg">
BCP47
</ins></a></cite><ins class="diff-chg">
],
normalized
to
lowercase
(e.g.,
</ins><code><ins class="diff-chg">
'en'
</ins></code>,<code><ins class="diff-chg">
'fr'
</ins></code>,<code><ins class="diff-chg">
'en-gb'
</ins></code><ins class="diff-chg">
).
They
may
also
have
a
datatype
attribute
such
as
</ins><code><ins class="diff-chg">
xsd:string
</ins></code>.</p><p><ins class="diff-chg">
LiteralNodes
representing
values
</ins>
with
<ins class="diff-new">a
specific
datatype,
such
as
</ins>
the
<del class="diff-old">object
</del>
<ins class="diff-chg">integer
72,
may
have
a
</ins><code><ins class="diff-chg">
datatype
</ins></code><ins class="diff-chg">
attribute
specified
</ins>
in
<del class="diff-old">BCP47
format.
</del>
<ins class="diff-chg">the
form
of
a
</ins><a href="#idl-def-NamedNode" class="idlType">
<code>
<ins class="diff-chg">NamedNode
</ins></code>
</a>
<ins class="diff-chg">(e.g.,
</ins><code><ins class="diff-chg">
&lt;http://www.w3.org/2001/XMLSchema#integer&gt;
</ins></code><ins class="diff-chg">
).
</ins></p>      <pre class="idl"><span id="idl-def-LiteralNode" class="idlInterface">[<span class="extAttr">NoInterfaceObject</span>]<ins class="diff-chg">
interface <span class="idlInterfaceID">LiteralNode</span> : <span class="idlSuperclass"><a href="#idl-def-Node" class="idlType"><code>Node</code></a></span> {
</ins><span class="idlAttribute">    readonly attribute <span class="idlAttrType"><a>DOMString</a></span>  <span class="idlAttrName"><a href="#widl-LiteralNode-nominalValue">nominalValue</a></span>;</span><span class="idlAttribute">    readonly attribute <span class="idlAttrType"><a>DOMString</a>?</span> <span class="idlAttrName"><a href="#widl-LiteralNode-language">language</a></span>;</span><span class="idlAttribute">    readonly attribute <span class="idlAttrType"><a href="#idl-def-NamedNode" class="idlType"><code>NamedNode</code></a>?</span> <span class="idlAttrName"><a href="#widl-LiteralNode-datatype">datatype</a></span>;</span><ins class="diff-chg">
};</span>
</ins></pre>
<div id="attributes-4" class="section">
<del class="diff-old">No
exceptions.
</del>
<h5>
<span class="secno">
<ins class="diff-chg">2.3.7.1
</ins></span><ins class="diff-chg">
Attributes
</ins></h5>
<dl class="attributes">
<del class="diff-old">Return
type:
</del>
<dt id="widl-LiteralNode-datatype">
<code>
<ins class="diff-new">datatype
</ins></code><ins class="diff-new">
of
type
</ins><span class="idlAttrType"><a href="#idl-def-NamedNode" class="idlType"><code><ins class="diff-new">
NamedNode
</ins></code></a></span>,<ins class="diff-new">
readonly,
nullable
</ins></dt><dd><ins class="diff-new">
An
optional
datatype
identified
by
a
NamedNode.
</ins></dd><dt id="widl-LiteralNode-language"><code><ins class="diff-new">
language
</ins></code><ins class="diff-new">
of
type
</ins><span class="idlAttrType">
<a>
<del class="diff-old">void
</del>
<ins class="diff-chg">DOMString
</ins></a></span>,<ins class="diff-chg">
readonly,
nullable
</ins></dt><dd><ins class="diff-chg">
An
optional
language
string
as
defined
in
[
</ins><cite><a class="bibref" rel="biblioentry" href="#bib-BCP47"><ins class="diff-chg">
BCP47
</ins>
</a>
</cite>
<ins class="diff-new">],
normalized
to
lowercase.
</ins></dd><dt id="widl-LiteralNode-nominalValue"><code><ins class="diff-new">
nominalValue
</ins>
</code>
<ins class="diff-new">of
type
</ins><span class="idlAttrType">
<a>
<ins class="diff-chg">DOMString
</ins></a>
</span>,
<ins class="diff-new">readonly
</ins></dt><dd><ins class="diff-new">
The
lexical
representation
of
the
LiteralNodes
value.
</ins>
</dd>
</dl>
</div>
</div>
</div>
</div>
<div id="algorithms" class="section">
<h2>
<span class="secno">
3.
</span>
Algorithms
</h2>
<p>
All
algorithms
described
in
this
section
are
intended
to
operate
on
language-native
data
structures.
That
is,
the
serialization
to
a
text-based
JSON
document
isn't
required
as
input
or
output
to
any
of
these
algorithms
and
language-native
data
structures
<em class="rfc2119" title="must">
must
</em>
be
used
where
applicable.
</p>
<div id="syntax-tokens-and-keywords" class="section">
<h3>
<span class="secno">
3.1
</span>
Syntax
Tokens
and
Keywords
</h3>
<p>
JSON-LD
specifies
a
number
of
syntax
tokens
and
<dfn title="keyword" id="dfn-keyword">
keyword
</dfn>
s
that
are
using
in
all
algorithms
described
in
this
section:
</p>
<dl>
<dt>
<code>
@context
</code>
</dt>
<dd>
Used
to
set
the
<a class="tref internalDFN" title="local_context" href="#dfn-local_context">
local
context
</a>.
</dd>
<dt>
<code>
@id
</code>
</dt>
<dd>
Sets
the
active
subject.
</dd>
<dt>
<code>
@language
</code>
</dt>
<dd>
Used
to
specify
the
language
for
a
literal.
</dd>
<dt>
<code>
@type
</code>
</dt>
<dd>
Used
to
set
the
type
of
the
active
subject
or
the
datatype
of
a
literal.
</dd>
<dt>
<code>
@value
</code>
</dt>
<dd>
Used
to
specify
the
value
of
a
literal.
</dd>
<dt>
<code>
<ins class="diff-new">@container
</ins></code></dt><dd><ins class="diff-new">
Used
to
set
the
container
of
a
particular
value.
</ins></dd><dt><code><ins class="diff-new">
@list
</ins></code></dt><dd><ins class="diff-new">
Used
to
express
an
ordered
set
of
data.
</ins></dd><dt><code><ins class="diff-new">
@set
</ins></code></dt><dd><ins class="diff-new">
Used
to
express
an
unordered
set
of
data.
</ins></dd><dt><code><ins class="diff-new">
@graph
</ins></code></dt><dd><ins class="diff-new">
Used
to
explicitly
express
a
</ins><a class="tref internalDFN" title="linked_data_graph" href="#dfn-linked_data_graph"><ins class="diff-new">
linked
data
graph
</ins></a>.</dd><dt>
<code>:
</code>
</dt>
<dd>
The
separator
for
JSON
keys
and
values
that
use
<a class="tref internalDFN" title="compact_iri" href="#dfn-compact_iri">
<ins class="diff-new">compact
IRIs
</ins></a>.</dd><dt><code><ins class="diff-new">
@default
</ins></code></dt><dd><ins class="diff-new">
Used
in
</ins><a href="#framing"><ins class="diff-new">
Framing
</ins></a><ins class="diff-new">
to
set
</ins>
the
<del class="diff-old">prefix
</del>
<ins class="diff-chg">defeault
value
for
an
output
property
when
the
framed
</ins><a class="tref internalDFN" title="subject_definition" href="#dfn-subject_definition"><ins class="diff-chg">
subject
definition
</ins>
</a>
<del class="diff-old">mechanism.
</del>
<ins class="diff-chg">does
not
include
such
a
property.
</ins></dd><dt><code><ins class="diff-chg">
@explicit
</ins></code></dt><dd><ins class="diff-chg">
Used
in
</ins><a href="#framing"><ins class="diff-chg">
Framing
</ins></a><ins class="diff-chg">
to
override
the
value
of
</ins><a class="tref internalDFN" title="explicit_inclusion_flag" href="#dfn-explicit_inclusion_flag"><ins class="diff-chg">
explicit
inclusion
flag
</ins></a><ins class="diff-chg">
within
a
specific
frame.
</ins></dd><dt><code><ins class="diff-chg">
@omitDefault
</ins></code></dt><dd><ins class="diff-chg">
Used
in
</ins><a href="#framing"><ins class="diff-chg">
Framing
</ins></a><ins class="diff-chg">
to
override
the
value
of
</ins><a class="tref internalDFN" title="omit_default_flag" href="#dfn-omit_default_flag"><ins class="diff-chg">
omit
default
flag
</ins></a><ins class="diff-chg">
within
a
specific
frame.
</ins></dd><dt><code><ins class="diff-chg">
@embed
</ins></code></dt><dd><ins class="diff-chg">
Used
in
</ins><a href="#framing"><ins class="diff-chg">
Framing
</ins></a><ins class="diff-chg">
to
override
the
value
of
</ins><a class="tref internalDFN" title="object_embed_flag" href="#dfn-object_embed_flag"><ins class="diff-chg">
object
embed
flag
</ins></a><ins class="diff-chg">
within
a
specific
frame.
</ins></dd><dt><code><ins class="diff-chg">
@null
</ins></code></dt><dd><ins class="diff-chg">
&gt;Used
in
</ins><a href="#framing"><ins class="diff-chg">
Framing
</ins></a><ins class="diff-chg">
when
a
value
of
</ins><a class="tref internalDFN" title="null" href="#dfn-null"><ins class="diff-chg">
null
</ins></a><ins class="diff-chg">
should
be
returned,
which
would
otherwise
be
removed
when
</ins><a href="#compaction"><ins class="diff-chg">
Compacting
</ins></a>.
</dd>
</dl>
<p>
All
JSON-LD
tokens
and
keywords
are
case-sensitive.
</p>
</div>
<div id="algorithm-terms" class="section">
<h3>
<span class="secno">
3.2
</span>
Algorithm
Terms
</h3>
<dl>
<dt>
<dfn title="initial_context" id="dfn-initial_context">
initial
context
</dfn>
</dt>
<dd>
a
context
that
is
specified
to
the
algorithm
before
processing
begins.
The
contents
of
the
initial
context
is
defined
in
<a href="#appendix-b">
Appendix
B
</a>.
</dd>
<dt>
<dfn title="active_subject" id="dfn-active_subject">
active
subject
</dfn>
</dt>
<dd>
the
currently
active
subject
that
the
processor
should
use
when
processing.
</dd>
<dt>
<dfn title="active_property" id="dfn-active_property">
active
property
</dfn>
</dt>
<dd>
the
currently
active
property
that
the
processor
should
use
when
processing.
<ins class="diff-new">The
active
property
is
represented
in
the
original
lexical
form,
which
is
used
for
finding
coercion
mappings
in
the
</ins><a class="tref internalDFN" title="active_context" href="#dfn-active_context"><ins class="diff-new">
active
context
</ins></a>.
</dd>
<dt>
<dfn title="active_object" id="dfn-active_object">
active
object
</dfn>
</dt>
<dd>
the
currently
active
object
that
the
processor
should
use
when
processing.
</dd>
<dt>
<dfn title="active_context" id="dfn-active_context">
active
context
</dfn>
</dt>
<dd>
a
context
that
is
used
to
resolve
<a class="tref internalDFN" title="term" href="#dfn-term">
term
</a>
s
while
the
processing
algorithm
is
running.
The
<a class="tref internalDFN" title="active_context" href="#dfn-active_context">
active
context
</a>
is
the
context
contained
within
the
<a class="tref internalDFN" title="processor_state" href="#dfn-processor_state">
processor
state
</a>.
</dd>
<dt>
<dfn title="blank_node" id="dfn-blank_node">
blank
node
</dfn>
</dt>
<dd>
a
blank
node
is
a
<a class="tref internalDFN" title="resource" href="#dfn-resource">
resource
</a>
which
is
neither
an
<a class="tref internalDFN" title="iri" href="#dfn-iri">
<abbr title="Internationalized Resource Identifier">
IRI
</abbr>
</a>
nor
a
<a class="tref internalDFN" title="literal" href="#dfn-literal">
literal
</a>.
Blank
nodes
may
be
named
or
unnamed
and
often
take
on
the
role
of
a
variable
that
may
represent
either
an
<a class="tref internalDFN" title="iri" href="#dfn-iri">
<abbr title="Internationalized Resource Identifier">
IRI
</abbr>
</a>
or
a
<a class="tref internalDFN" title="literal" href="#dfn-literal">
literal
</a>.
</dd>
<dt>
<dfn title="compact_iri" id="dfn-compact_iri">
<ins class="diff-new">compact
</ins><abbr title="Internationalized Resource Identifier"><ins class="diff-new">
IRI
</ins></abbr></dfn></dt><dd><ins class="diff-new">
a
compact
</ins><abbr title="Internationalized Resource Identifier"><ins class="diff-new">
IRI
</ins></abbr><ins class="diff-new">
is
has
the
form
of
</ins><a class="tref internalDFN" title="prefix" href="#dfn-prefix"><ins class="diff-new">
prefix
</ins></a><ins class="diff-new">
and
</ins><em><ins class="diff-new">
suffix
</ins></em><ins class="diff-new">
and
is
used
as
a
way
of
expressing
an
</ins><abbr title="Internationalized Resource Identifier"><ins class="diff-new">
IRI
</ins></abbr><ins class="diff-new">
without
needing
to
define
separate
</ins><a class="tref internalDFN" title="term" href="#dfn-term"><ins class="diff-new">
term
</ins></a><ins class="diff-new">
definitions
for
each
</ins><abbr title="Internationalized Resource Identifier"><ins class="diff-new">
IRI
</ins></abbr><ins class="diff-new">
contained
within
a
common
vocabulary
identified
by
</ins><a class="tref internalDFN" title="prefix" href="#dfn-prefix"><ins class="diff-new">
prefix
</ins></a>.</dd><dt>
<dfn title="local_context" id="dfn-local_context">
local
context
</dfn>
</dt>
<dd>
a
context
that
is
specified
within
a
<a class="tref internalDFN" title="json_object" href="#dfn-json_object">
JSON
object
</a>,
specified
via
the
<code>
@context
</code>
<a class="tref internalDFN" title="keyword" href="#dfn-keyword">
keyword
</a>.
</dd>
<dt>
<dfn title="processor_state" id="dfn-processor_state">
processor
state
</dfn>
</dt>
<dd>
the
<a class="tref internalDFN" title="processor_state" href="#dfn-processor_state">
processor
state
</a>,
which
includes
the
<a class="tref internalDFN" title="active_context" href="#dfn-active_context">
active
context
</a>,
<a class="tref internalDFN" title="active_subject" href="#dfn-active_subject">
active
subject
</a>,
and
<a class="tref internalDFN" title="active_property" href="#dfn-active_property">
active
property
</a>.
The
<a class="tref internalDFN" title="processor_state" href="#dfn-processor_state">
processor
state
</a>
is
managed
as
a
stack
with
elements
from
the
previous
<a class="tref internalDFN" title="processor_state" href="#dfn-processor_state">
processor
state
</a>
copied
into
a
new
<a class="tref internalDFN" title="processor_state" href="#dfn-processor_state">
processor
state
</a>
when
entering
a
new
<a class="tref internalDFN" title="json_object" href="#dfn-json_object">
JSON
object
</a>.
</dd>
<dt>
<dfn title="json-ld_input" id="dfn-json-ld_input">
JSON-LD
input
</dfn>
</dt>
<dd>
The
JSON-LD
data
structure
that
is
provided
as
input
to
the
algorithm.
</dd>
<dt>
<dfn title="json-ld_output" id="dfn-json-ld_output">
JSON-LD
output
</dfn>
</dt>
<dd>
The
JSON-LD
data
structure
that
is
produced
as
output
by
the
algorithm.
</dd>
<dt>
<dfn title="term" id="dfn-term">
term
</dfn>
</dt>
<dd>
A
<a class="tref internalDFN" title="term" href="#dfn-term">
term
</a>
is
a
short
word
defined
<del class="diff-old">with
</del>
<ins class="diff-chg">in
</ins>
a
context
that
<em class="rfc2119" title="may">
may
</em>
be
expanded
to
an
<a class="tref internalDFN" title="iri" href="#dfn-iri">
<abbr title="Internationalized Resource Identifier">
IRI
</abbr>
</a>
</dd>
<dt>
<dfn title="prefix" id="dfn-prefix">
prefix
</dfn>
</dt>
<dd>
A
<a class="tref internalDFN" title="prefix" href="#dfn-prefix">
prefix
</a>
is
a
<a class="tref internalDFN" title="term" href="#dfn-term">
term
</a>
that
expands
to
a
<del class="diff-old">Web
Vocabulary
</del>
<ins class="diff-chg">vocabulary
</ins>
base
<abbr title="Internationalized Resource Identifier">
IRI
</abbr>.
It
is
typically
used
along
with
a
<em>
suffix
</em>
to
<ins class="diff-new">form
a
</ins><a class="tref internalDFN" title="compact_iri" href="#dfn-compact_iri"><ins class="diff-new">
compact
</ins><abbr title="Internationalized Resource Identifier"><ins class="diff-new">
IRI
</ins></abbr></a><ins class="diff-new">
to
</ins>
create
an
<abbr title="Internationalized Resource Identifier">
IRI
</abbr>
within
a
<del class="diff-old">Web
Vocabulary.
</del>
<ins class="diff-chg">vocabulary.
</ins>
</dd>
<dt>
<dfn title="plain_literal" id="dfn-plain_literal">
plain
literal
</dfn>
</dt>
<dd>
A
<a class="tref internalDFN" title="plain_literal" href="#dfn-plain_literal">
plain
literal
</a>
is
a
<a class="tref internalDFN" title="literal" href="#dfn-literal">
literal
</a>
without
a
datatype,
possibly
including
a
language.
</dd>
<dt>
<dfn title="typed_literal" id="dfn-typed_literal">
typed
literal
</dfn>
</dt>
<dd>
A
<a class="tref internalDFN" title="typed_literal" href="#dfn-typed_literal">
typed
literal
</a>
is
a
<a class="tref internalDFN" title="literal" href="#dfn-literal">
literal
</a>
with
an
associated
<a class="tref internalDFN" title="iri" href="#dfn-iri">
<abbr title="Internationalized Resource Identifier">
IRI
</abbr>
</a>
which
indicates
the
literal's
datatype.
</dd>
</dl>
</div>
<div id="context-processing" class="section">
<h3 id="context">
<span class="secno">
3.3
</span>
Context
<ins class="diff-new">Processing
</ins>
</h3>
<p>
Processing
of
JSON-LD
data
structure
is
managed
recursively.
During
processing,
each
rule
is
applied
using
information
provided
by
the
<a class="tref internalDFN" title="active_context" href="#dfn-active_context">
active
context
</a>.
Processing
begins
by
pushing
a
new
<a class="tref internalDFN" title="processor_state" href="#dfn-processor_state">
processor
state
</a>
onto
the
<a class="tref internalDFN" title="processor_state" href="#dfn-processor_state">
processor
state
</a>
stack
and
initializing
the
<a class="tref internalDFN" title="active_context" href="#dfn-active_context">
active
context
</a>
with
the
<a class="tref internalDFN" title="initial_context" href="#dfn-initial_context">
initial
context
</a>.
If
a
<a class="tref internalDFN" title="local_context" href="#dfn-local_context">
local
context
</a>
is
encountered,
information
from
the
<a class="tref internalDFN" title="local_context" href="#dfn-local_context">
local
context
</a>
is
merged
into
the
<a class="tref internalDFN" title="active_context" href="#dfn-active_context">
active
context
</a>.
</p>
<p>
The
<a class="tref internalDFN" title="active_context" href="#dfn-active_context">
active
context
</a>
is
used
for
expanding
<del class="diff-old">keys
</del>
<ins class="diff-chg">properties
</ins>
and
values
of
a
<a class="tref internalDFN" title="json_object" href="#dfn-json_object">
JSON
object
</a>
(or
elements
of
a
list
(see
<span a="#list-processing">
List
Processing
</span>
))
using
a
<dfn title="term_mapping" id="dfn-term_mapping">
term
mapping
</dfn>.
It
is
also
used
to
maintain
<dfn title="coercion_mapping" id="dfn-coercion_mapping">
coercion
mapping
</dfn>
s
from
<del class="diff-old">IRIs
associated
with
</del>
terms
to
datatypes,
<dfn title="language_mapping" id="dfn-language_mapping">
<ins class="diff-new">language
mapping
</ins></dfn><ins class="diff-new">
s
from
terms
to
language
codes,
</ins>
and
<dfn title="list_mapping" id="dfn-list_mapping">
list
mapping
</dfn>
s
<ins class="diff-new">and
</ins><dfn title="set_mapping" id="dfn-set_mapping"><ins class="diff-new">
set
mapping
</ins></dfn><ins class="diff-new">
s
</ins>
for
<del class="diff-old">IRIs
associated
with
</del>
terms.
<ins class="diff-new">Processors
</ins><em class="rfc2119" title="must"><ins class="diff-new">
must
</ins></em><ins class="diff-new">
use
the
lexical
form
of
the
property
when
creating
a
mapping,
as
lookup
is
performed
on
lexical
representations,
not
expanded
</ins><abbr title="Internationalized Resource Identifier"><ins class="diff-new">
IRI
</ins></abbr><ins class="diff-new">
representations.
</ins>
</p>
<p>
A
<a class="tref internalDFN" title="local_context" href="#dfn-local_context">
local
context
</a>
is
identified
within
a
<a class="tref internalDFN" title="json_object" href="#dfn-json_object">
JSON
object
</a>
having
a
<del class="diff-old">key
of
</del>
<code>
@context
</code>
<ins class="diff-new">property
</ins>
with
<ins class="diff-new">a
</ins>
<a class="tref internalDFN" title="string" href="#dfn-string">
string
</a>,
<a class="tref internalDFN" title="array" href="#dfn-array">
array
</a>
or
a
<a class="tref internalDFN" title="json_object" href="#dfn-json_object">
JSON
object
</a>
value.
When
processing
a
<a class="tref internalDFN" title="local_context" href="#dfn-local_context">
local
context
</a>,
special
processing
rules
apply:
</p>
<ol class="algorithm">
<li>
Create
a
new,
empty
<a class="tref internalDFN" title="local_context" href="#dfn-local_context">
local
context
</a>.
</li>
<li>
Let
<em>
<del class="diff-old">value
</del>
<ins class="diff-chg">context
</ins>
</em>
be
the
value
of
<code>
@context
</code>
<ol class="algorithm">
<li id="process-context">
<ins class="diff-chg">If
</ins><em><ins class="diff-chg">
context
</ins></em><ins class="diff-chg">
equals
</ins><a class="tref internalDFN" title="null" href="#dfn-null"><ins class="diff-chg">
null
</ins></a>,<ins class="diff-chg">
reset
the
</ins><a class="tref internalDFN" title="active_context" href="#dfn-active_context"><ins class="diff-chg">
active
context
</ins></a><ins class="diff-chg">
to
the
</ins><a class="tref internalDFN" title="initial_context" href="#dfn-initial_context"><ins class="diff-chg">
initial
context
</ins></a>.</li>
<li>
If
<em>
<del class="diff-old">value
</del>
<ins class="diff-chg">context
</ins>
</em>
is
an
<a class="tref internalDFN" title="array" href="#dfn-array">
array
</a>,
process
each
element
as
<em>
<del class="diff-old">value
,
</del>
<ins class="diff-chg">context
</ins></em>
in
order
<del class="diff-old">using
</del>
<ins class="diff-chg">by
starting
at
</ins>
<a href="#process-context">
Step
<del class="diff-old">2
</del>
<ins class="diff-chg">2.1
</ins>
</a>.
</li>
<li>
If
<em>
<del class="diff-old">value
</del>
<ins class="diff-chg">context
</ins>
</em>
is
a
<del class="diff-old">simple
</del>
<a class="tref internalDFN" title="string" href="#dfn-string">
string
</a>,
it
<em class="rfc2119" title="must">
must
</em>
have
a
lexical
form
of
<a class="tref internalDFN" title="absolute_iri" href="#dfn-absolute_iri">
absolute
<abbr title="Internationalized Resource Identifier">
IRI
<del class="diff-old">.
</del>
</abbr>
</a>.
<ol class="algorithm">
<li>
Dereference
<em>
<del class="diff-old">value
</del>
<ins class="diff-chg">context
</ins>
</em>.
</li>
<li>
If
the
resulting
document
is
a
JSON
document,
extract
the
top-level
<code>
@context
</code>
element
using
the
JSON
Pointer
&quot;/@context&quot;
as
described
in
[
<cite>
<a class="bibref" rel="biblioentry" href="#bib-JSON-POINTER">
JSON-POINTER
</a>
</cite>
].
Set
<em>
<del class="diff-old">value
</del>
<ins class="diff-chg">context
</ins>
</em>
to
the
extracted
<del class="diff-old">content,
or
an
empty
JSON
Object
if
no
value
exists.
Merge
the
of
local
context
into
the
active
context
</del>
<ins class="diff-chg">content
and
process
it
by
starting
at
</ins><a href="#process-context"><ins class="diff-chg">
Step
2.1
</ins>
</a>.
</li>
</ol>
</li>
<li>
If
<em>
<del class="diff-old">value
</del>
<ins class="diff-chg">context
</ins>
</em>
is
a
<a class="tref internalDFN" title="json_object" href="#dfn-json_object">
JSON
object
</a>,
perform
the
following
steps:
<ol class="algorithm">
<li>
If
<em>
<del class="diff-old">value
</del>
<ins class="diff-chg">context
</ins>
</em>
has
a
<code>
@language
</code>
<del class="diff-old">key,
</del>
<ins class="diff-chg">property,
</ins>
it
<em class="rfc2119" title="must">
must
</em>
have
a
value
of
a
simple
<a class="tref internalDFN" title="string" href="#dfn-string">
string
</a>
or
<a class="tref internalDFN" title="null" href="#dfn-null">
null
<del class="diff-old">.
</del>
</a>.
Add
the
language
to
the
<a class="tref internalDFN" title="local_context" href="#dfn-local_context">
local
context
</a>.
</li>
<li id="object-context">
Otherwise,
for
each
<del class="diff-old">key
</del>
<ins class="diff-chg">property
</ins>
in
<em>
<del class="diff-old">value
</del>
<ins class="diff-chg">context
</ins>
</em>
<del class="diff-old">having
</del>
<ins class="diff-chg">perform
</ins>
the
<del class="diff-old">lexical
form
of
</del>
<ins class="diff-chg">following
steps:
</ins><ol class="algorithm"><li><ins class="diff-chg">
If
the
property's
value
is
a
simple
</ins><a class="tref internalDFN" title="string" href="#dfn-string"><ins class="diff-chg">
string
</ins></a>,<ins class="diff-chg">
determine
the
</ins><abbr title="Internationalized Resource Identifier"><ins class="diff-chg">
IRI
</ins></abbr><ins class="diff-chg">
mapping
value
by
performing
</ins><a href="#iri-expansion">
<del class="diff-old">NCName
</del>
<abbr title="Internationalized Resource Identifier">
<ins class="diff-chg">IRI
</ins></abbr><ins class="diff-chg">
Expansion
</ins>
</a>
<ins class="diff-new">on
the
associated
value.
If
the
result
of
the
</ins><abbr title="Internationalized Resource Identifier"><ins class="diff-new">
IRI
</ins></abbr><ins class="diff-new">
mapping
is
an
</ins><a class="tref internalDFN" title="absolute_iri" href="#dfn-absolute_iri"><ins class="diff-new">
absolute
</ins><abbr title="Internationalized Resource Identifier"><ins class="diff-new">
IRI
</ins></abbr>
<del class="diff-old">(see
[
XML-NAMES
</del>
</a>,
<ins class="diff-chg">merge
the
property
into
the
</ins><a class="tref internalDFN" title="local_context" href="#dfn-local_context"><ins class="diff-chg">
local
context
</ins>
</a>
<del class="diff-old">]),
or
</del>
<a class="tref internalDFN" title="term_mapping" href="#dfn-term_mapping">
<ins class="diff-chg">term
mapping
</ins></a>,<ins class="diff-chg">
unless
the
property
</ins>
is
<ins class="diff-new">a
JSON-LD
</ins><a class="tref internalDFN" title="keyword" href="#dfn-keyword"><ins class="diff-new">
keyword
</ins></a>,<ins class="diff-new">
in
which
case
throw
</ins>
an
<del class="diff-old">empty
string,
</del>
<ins class="diff-chg">exception.
</ins></li><li><ins class="diff-chg">
Otherwise,
if
the
property's
value
is
</ins><a class="tref internalDFN" title="null" href="#dfn-null"><ins class="diff-chg">
null
</ins></a><ins class="diff-chg">
remove
mapping,
coercion,
container
and
language
information
associated
with
property
from
the
</ins><a class="tref internalDFN" title="local_context" href="#dfn-local_context"><ins class="diff-chg">
local
context
</ins></a>.</li><li><ins class="diff-chg">
Otherwise,
the
</ins><em><ins class="diff-chg">
property
</ins></em><ins class="diff-chg">
's
</ins><em><ins class="diff-chg">
value
</ins></em><em class="rfc2119" title="must"><ins class="diff-chg">
must
</ins></em><ins class="diff-chg">
be
a
</ins><a class="tref internalDFN" title="json_object" href="#dfn-json_object"><ins class="diff-chg">
JSON
object
</ins></a>.
<ol class="algorithm">
<li>
If
the
<del class="diff-old">key's
value
</del>
<em>
<ins class="diff-chg">property
</ins></em>
is
a
<del class="diff-old">simple
string
,
</del>
<ins class="diff-chg">JSON-LD
</ins><a class="tref internalDFN" title="keyword" href="#dfn-keyword"><ins class="diff-chg">
keyword
</ins></a><ins class="diff-chg">
and
the
value
has
</ins><code><ins class="diff-chg">
@id
</ins></code>,<code><ins class="diff-chg">
@language
</ins></code><ins class="diff-chg">
or
</ins><code><ins class="diff-chg">
@type
</ins></code><ins class="diff-chg">
properties,
throw
an
exception.
</ins><div class="issue"><ins class="diff-chg">
Undecided
if
</ins><code><ins class="diff-chg">
@type
</ins></code><ins class="diff-chg">
or
</ins><code><ins class="diff-chg">
@graph
</ins></code><ins class="diff-chg">
can
take
a
</ins><code><ins class="diff-chg">
@container
</ins></code><ins class="diff-chg">
with
</ins><code><ins class="diff-chg">
@set
</ins></code>.</div></li><li><ins class="diff-chg">
If
the
</ins><em><ins class="diff-chg">
property
</ins></em><ins class="diff-chg">
has
</ins>
the
<ins class="diff-new">form
of
</ins><a class="tref internalDFN" title="term" href="#dfn-term"><ins class="diff-new">
term
</ins></a>,<ins class="diff-new">
it's
</ins><em>
value
</em>
<em class="rfc2119" title="must">
<ins class="diff-new">must
</ins></em><ins class="diff-new">
have
an
</ins><code><ins class="diff-new">
@id
</ins></code><ins class="diff-new">
property
with
a
string
value
which
</ins>
<em class="rfc2119" title="must">
must
</em>
have
the
form
of
<ins class="diff-new">a
</ins>
<a class="tref internalDFN" title="term" href="#dfn-term">
term
</a>,
<del class="diff-old">prefix
:suffix,
</del>
<a class="tref internalDFN" title="compact_iri" href="#dfn-compact_iri">
<ins class="diff-chg">compact
</ins><abbr title="Internationalized Resource Identifier"><ins class="diff-chg">
IRI
</ins></abbr></a>,<ins class="diff-chg">
or
</ins><a class="tref internalDFN" title="absolute_iri" href="#dfn-absolute_iri">
absolute
<abbr title="Internationalized Resource Identifier">
IRI
<del class="diff-old">.
</del>
</abbr>
</a>.
Determine
the
<abbr title="Internationalized Resource Identifier">
IRI
</abbr>
mapping
<del class="diff-old">value
</del>
by
performing
<a href="#iri-expansion">
<abbr title="Internationalized Resource Identifier">
IRI
</abbr>
Expansion
</a>
on
the
associated
value.
If
the
result
of
the
<abbr title="Internationalized Resource Identifier">
IRI
</abbr>
mapping
is
an
<a class="tref internalDFN" title="absolute_iri" href="#dfn-absolute_iri">
absolute
<abbr title="Internationalized Resource Identifier">
IRI
<del class="diff-old">,
</del>
</abbr>
</a>,
merge
the
<del class="diff-old">key-value
pair
</del>
<em>
<ins class="diff-chg">property
</ins></em>
into
the
<a class="tref internalDFN" title="local_context" href="#dfn-local_context">
local
context
</a>
<a class="tref internalDFN" title="term_mapping" href="#dfn-term_mapping">
term
mapping
</a>.
</li>
<del class="diff-old">Otherwise,
</del>
<li>
<ins class="diff-chg">If
</ins>
the
<del class="diff-old">key's
value
must
</del>
<em>
<ins class="diff-chg">property
</ins>
</em>
<del class="diff-old">be
</del>
<ins class="diff-chg">has
the
form
of
of
</ins>
a
<del class="diff-old">JSON
object
.
The
</del>
<a class="tref internalDFN" title="compact_iri" href="#dfn-compact_iri">
<ins class="diff-chg">compact
</ins><abbr title="Internationalized Resource Identifier"><ins class="diff-chg">
IRI
</ins></abbr></a><ins class="diff-chg">
or
</ins><a class="tref internalDFN" title="absolute_iri" href="#dfn-absolute_iri"><ins class="diff-chg">
absolute
</ins><abbr title="Internationalized Resource Identifier"><ins class="diff-chg">
IRI
</ins></abbr></a>,<ins class="diff-chg">
the
</ins><em>
value
<del class="diff-old">must
</del>
</em>
<em class="rfc2119" title="may">
<ins class="diff-chg">may
</ins>
</em>
have
a
<code>
@id
</code>
<del class="diff-old">key
</del>
<ins class="diff-chg">property
</ins>
with
a
string
<del class="diff-old">value,
the
</del>
value
<ins class="diff-new">which
</ins>
<em class="rfc2119" title="must">
must
</em>
have
the
form
of
<ins class="diff-new">a
</ins>
<a class="tref internalDFN" title="term" href="#dfn-term">
term
</a>,
<del class="diff-old">prefix
:suffix,
</del>
<a class="tref internalDFN" title="compact_iri" href="#dfn-compact_iri">
<ins class="diff-chg">compact
</ins><abbr title="Internationalized Resource Identifier"><ins class="diff-chg">
IRI
</ins></abbr></a>,<ins class="diff-chg">
or
</ins>
absolute
<a class="tref internalDFN" title="iri" href="#dfn-iri">
<abbr title="Internationalized Resource Identifier">
IRI
<del class="diff-old">.
</del>
</abbr>
</a>.
Determine
the
<abbr title="Internationalized Resource Identifier">
IRI
</abbr>
mapping
<del class="diff-old">value
</del>
by
performing
<a href="#iri-expansion">
<abbr title="Internationalized Resource Identifier">
IRI
</abbr>
Expansion
</a>
on
the
associated
value.
If
the
result
of
the
<abbr title="Internationalized Resource Identifier">
IRI
</abbr>
mapping
is
an
<a class="tref internalDFN" title="absolute_iri" href="#dfn-absolute_iri">
absolute
<abbr title="Internationalized Resource Identifier">
IRI
<del class="diff-old">,
</del>
</abbr>
</a>,
merge
the
<del class="diff-old">key-value
pair
</del>
<em>
<ins class="diff-chg">property
</ins></em>
into
the
<a class="tref internalDFN" title="local_context" href="#dfn-local_context">
local
context
</a>
<a class="tref internalDFN" title="term_mapping" href="#dfn-term_mapping">
term
mapping
</a>.
</li>
<li>
If
the
<em>
value
</em>
has
a
<code>
@type
</code>
<del class="diff-old">key,
the
</del>
<ins class="diff-chg">property,
it's
</ins>
value
<em class="rfc2119" title="must">
must
</em>
have
the
form
of
<ins class="diff-new">a
</ins>
<a class="tref internalDFN" title="term" href="#dfn-term">
term
</a>,
<del class="diff-old">prefix
:suffix,
</del>
<a class="tref internalDFN" title="compact_iri" href="#dfn-compact_iri">
<ins class="diff-chg">compact
</ins><abbr title="Internationalized Resource Identifier"><ins class="diff-chg">
IRI
</ins></abbr></a>,<a class="tref internalDFN" title="absolute_iri" href="#dfn-absolute_iri">
absolute
<abbr title="Internationalized Resource Identifier">
IRI
</abbr>
</a>,
or
the
<a class="tref internalDFN" title="keyword" href="#dfn-keyword">
keyword
</a>
<code>
@id
</code>.
Determine
the
<abbr title="Internationalized Resource Identifier">
IRI
</abbr>
by
performing
<a href="#iri-expansion">
<abbr title="Internationalized Resource Identifier">
IRI
</abbr>
Expansion
</a>
on
the
associated
value.
If
the
result
of
the
<abbr title="Internationalized Resource Identifier">
IRI
</abbr>
mapping
is
an
<a class="tref internalDFN" title="absolute_iri" href="#dfn-absolute_iri">
absolute
<abbr title="Internationalized Resource Identifier">
IRI
</abbr>
</a>
or
<code>
@id
</code>,
merge
into
the
<a class="tref internalDFN" title="local_context" href="#dfn-local_context">
local
context
</a>
<a class="tref internalDFN" title="coercion_mapping" href="#dfn-coercion_mapping">
coercion
mapping
<del class="diff-old">.
</del>
</a>
<ins class="diff-chg">using
the
lexical
value
of
the
</ins><em><ins class="diff-chg">
property
</ins></em>.
</li>
<li>
If
the
<em>
value
</em>
has
a
<code>
<del class="diff-old">@list
</del>
<ins class="diff-chg">@container
</ins>
</code>
<del class="diff-old">key,
the
</del>
<ins class="diff-chg">property,
it's
</ins>
value
<em class="rfc2119" title="must">
must
</em>
be
<code>
<del class="diff-old">true
</del>
<ins class="diff-chg">@list
</ins>
</code>
or
<code>
<del class="diff-old">false
</del>
<ins class="diff-chg">@set
</ins>
</code>.
Merge
<ins class="diff-new">the
</ins><a class="tref internalDFN" title="list_mapping" href="#dfn-list_mapping"><ins class="diff-new">
list
mapping
</ins></a><ins class="diff-new">
or
</ins><a class="tref internalDFN" title="set_mapping" href="#dfn-set_mapping"><ins class="diff-new">
set
mapping
</ins></a>
into
the
<a class="tref internalDFN" title="local_context" href="#dfn-local_context">
local
context
</a>
<del class="diff-old">list
mapping
</del>
<ins class="diff-chg">using
the
lexical
value
of
the
</ins><em><ins class="diff-chg">
property
</ins></em>.</li><li><ins class="diff-chg">
If
the
</ins><em><ins class="diff-chg">
value
</ins></em><ins class="diff-chg">
has
a
</ins><code><ins class="diff-chg">
@language
</ins></code><ins class="diff-chg">
property
but
no
</ins><code><ins class="diff-chg">
@type
</ins></code><ins class="diff-chg">
property,
the
value
of
the
</ins><code><ins class="diff-chg">
@language
</ins></code><ins class="diff-chg">
property
</ins><em class="rfc2119" title="must"><ins class="diff-chg">
must
</ins></em><ins class="diff-chg">
be
a
</ins><a class="tref internalDFN" title="string" href="#dfn-string"><ins class="diff-chg">
string
</ins></a><ins class="diff-chg">
or
</ins><a class="tref internalDFN" title="null" href="#dfn-null"><ins class="diff-chg">
null
</ins>
</a>.
<ins class="diff-new">Merge
the
</ins><a class="tref internalDFN" title="language_mapping" href="#dfn-language_mapping"><ins class="diff-new">
language
mapping
</ins></a><ins class="diff-new">
into
the
</ins><a class="tref internalDFN" title="local_context" href="#dfn-local_context"><ins class="diff-new">
local
context
</ins></a><ins class="diff-new">
using
the
lexical
value
of
the
</ins><em><ins class="diff-new">
property
</ins></em>.
</li>
</ol>
</li>
<li>
Merge
the
<a class="tref internalDFN" title="local_context" href="#dfn-local_context">
local
context
</a>
into
the
<a class="tref internalDFN" title="active_context" href="#dfn-active_context">
active
context
</a>.
</li>
<li>
Repeat
<a href="#object-context">
Step
<del class="diff-old">3.2
</del>
<ins class="diff-chg">2.4.2
</ins>
</a>
until
no
entries
are
added
to
the
<a class="tref internalDFN" title="local_context" href="#dfn-local_context">
local
context
</a>.
</li>
</ol>
</li>
</ol>
</li>
</ol>
</li>
</ol>
<p class="note">
It
can
be
difficult
to
distinguish
between
a
<del class="diff-old">prefix:suffix
</del>
<a class="tref internalDFN" title="compact_iri" href="#dfn-compact_iri">
<ins class="diff-chg">compact
</ins><abbr title="Internationalized Resource Identifier"><ins class="diff-chg">
IRI
</ins></abbr></a>
and
an
<a class="tref internalDFN" title="absolute_iri" href="#dfn-absolute_iri">
absolute
<abbr title="Internationalized Resource Identifier">
IRI
<del class="diff-old">,
</del>
</abbr>
</a>,
as
a
<del class="diff-old">prefix
</del>
<a class="tref internalDFN" title="compact_iri" href="#dfn-compact_iri">
<ins class="diff-chg">compact
</ins><abbr title="Internationalized Resource Identifier"><ins class="diff-chg">
IRI
</ins></abbr>
</a>
may
seem
to
be
a
valid
<abbr title="Internationalized Resource Identifier">
IRI
</abbr>
<em>
scheme
</em>.
When
performing
repeated
<abbr title="Internationalized Resource Identifier">
IRI
</abbr>
expansion,
a
term
used
as
a
prefix
may
not
have
a
valid
mapping
due
to
dependencies
in
resolving
term
definitions.
By
continuing
<a href="#object-context">
Step
<del class="diff-old">3.2
</del>
<ins class="diff-chg">2.3.2
</ins>
</a>
until
no
changes
are
made,
mappings
to
IRIs
created
using
an
undefined
term
prefix
will
eventually
resolve
to
<a class="tref internalDFN" title="absolute_iri" href="#dfn-absolute_iri">
absolute
<del class="diff-old">IRIs.
</del>
<abbr title="Internationalized Resource Identifier">
<ins class="diff-chg">IRI
</ins></abbr></a><ins class="diff-chg">
s.
</ins>
</p>
<p class="issue">
<a href="https://github.com/json-ld/json-ld.org/issues/43">
Issue
43
</a>
concerns
performing
<abbr title="Internationalized Resource Identifier">
IRI
</abbr>
expansion
in
the
key
position
of
a
context
definition.
</p>
</div>
<div id="iri-expansion" class="section">
<h3>
<span class="secno">
3.4
</span>
<abbr title="Internationalized Resource Identifier">
IRI
</abbr>
Expansion
</h3>
<p>
Keys
and
some
values
are
evaluated
to
produce
an
<a class="tref internalDFN" title="iri" href="#dfn-iri">
<abbr title="Internationalized Resource Identifier">
IRI
<del class="diff-old">.
</del>
</abbr>
</a>.
This
section
defines
an
algorithm
for
transforming
a
value
representing
an
<abbr title="Internationalized Resource Identifier">
IRI
</abbr>
into
an
actual
<abbr title="Internationalized Resource Identifier">
IRI
</abbr>.
</p>
<p>
<del class="diff-old">IRIs
</del>
<a class="tref internalDFN" title="iri" href="#dfn-iri">
<abbr title="Internationalized Resource Identifier">
<ins class="diff-chg">IRI
</ins></abbr></a><ins class="diff-chg">
s
</ins>
may
be
represented
as
an
<a class="tref internalDFN" title="absolute_iri" href="#dfn-absolute_iri">
absolute
<abbr title="Internationalized Resource Identifier">
IRI
<del class="diff-old">,
</del>
</abbr>
</a>,
a
<a class="tref internalDFN" title="term" href="#dfn-term">
term
</a>
or
a
<del class="diff-old">prefix
:suffix
construct.
</del>
<a class="tref internalDFN" title="compact_iri" href="#dfn-compact_iri">
<ins class="diff-chg">compact
</ins><abbr title="Internationalized Resource Identifier"><ins class="diff-chg">
IRI
</ins></abbr></a>.</p><p><ins class="diff-chg">
An
</ins><dfn title="absolute_iri" id="dfn-absolute_iri"><ins class="diff-chg">
absolute
</ins><abbr title="Internationalized Resource Identifier"><ins class="diff-chg">
IRI
</ins></abbr></dfn><ins class="diff-chg">
is
defined
in
[
</ins><cite><a class="bibref" rel="biblioentry" href="#bib-RFC3987"><ins class="diff-chg">
RFC3987
</ins></a></cite><ins class="diff-chg">
]
containing
a
</ins><em><ins class="diff-chg">
scheme
</ins></em><ins class="diff-chg">
along
with
</ins><em><ins class="diff-chg">
path
</ins></em><ins class="diff-chg">
and
optional
</ins><em><ins class="diff-chg">
query
</ins></em><ins class="diff-chg">
and
fragment
segments.
A
</ins><dfn title="relative_iri" id="dfn-relative_iri"><ins class="diff-chg">
relative
</ins><abbr title="Internationalized Resource Identifier"><ins class="diff-chg">
IRI
</ins></abbr></dfn><ins class="diff-chg">
is
an
</ins><abbr title="Internationalized Resource Identifier"><ins class="diff-chg">
IRI
</ins></abbr><ins class="diff-chg">
that
is
relative
some
other
</ins><a class="tref internalDFN" title="absolute_iri" href="#dfn-absolute_iri"><ins class="diff-chg">
absolute
</ins><abbr title="Internationalized Resource Identifier"><ins class="diff-chg">
IRI
</ins></abbr></a><ins class="diff-chg">
;
in
the
case
of
JSON-LD
this
is
the
base
location
of
the
document.
</ins>
</p>
<p>
The
algorithm
for
generating
an
<abbr title="Internationalized Resource Identifier">
IRI
</abbr>
is:
</p>
<ol class="algorithm">
<li>
<del class="diff-old">Split
</del>
<ins class="diff-chg">If
the
</ins><a class="tref internalDFN" title="active_context" href="#dfn-active_context"><ins class="diff-chg">
active
context
</ins></a><ins class="diff-chg">
contains
a
</ins><a class="tref internalDFN" title="term" href="#dfn-term"><ins class="diff-chg">
term
</ins></a><ins class="diff-chg">
mapping
for
the
value
using
a
case-sensitive
comparison,
use
the
mapped
value
as
an
</ins><abbr title="Internationalized Resource Identifier"><ins class="diff-chg">
IRI
</ins></abbr>.</li><li><ins class="diff-chg">
Otherwise,
split
</ins>
the
value
into
a
<em>
prefix
</em>
and
<em>
suffix
</em>
from
the
first
occurrence
of
':'.
</li>
<li>
If
the
prefix
is
a
'_'
(underscore),
the
value
represents
a
named
<a class="tref internalDFN" title="blank_node" href="#dfn-blank_node">
blank
node
</a>.
</li>
<li>
If
the
<a class="tref internalDFN" title="active_context" href="#dfn-active_context">
active
context
</a>
contains
a
<a class="tref internalDFN" title="term" href="#dfn-term">
term
</a>
mapping
for
<em>
prefix
</em>
using
a
case-sensitive
comparison,
<ins class="diff-new">and
</ins><em><ins class="diff-new">
suffix
</ins></em><ins class="diff-new">
does
not
does
not
begin
with
'//'
(i.e.,
it
does
not
match
a
</ins><em><ins class="diff-new">
hier-part
</ins></em><ins class="diff-new">
including
</ins><em><ins class="diff-new">
authority
</ins></em><ins class="diff-new">
(as
defined
in
[
</ins><cite><a class="bibref" rel="biblioentry" href="#bib-RFC3986"><ins class="diff-new">
RFC3986
</ins></a></cite><ins class="diff-new">
]),
</ins>
generate
an
<a class="tref internalDFN" title="iri" href="#dfn-iri">
<abbr title="Internationalized Resource Identifier">
IRI
</abbr>
</a>
by
prepending
the
mapped
prefix
to
the
(possibly
empty)
suffix
using
textual
concatenation.
Note
that
an
empty
suffix
and
no
suffix
(meaning
the
value
contains
no
':'
string
at
all)
are
treated
equivalently.
</li>
<li>
Otherwise,
use
the
value
directly
as
an
<abbr title="Internationalized Resource Identifier">
IRI
</abbr>.
</li>
</ol>
<p>
</p>
<p class="note">
Previous
versions
of
this
specification
used
<code>
@base
</code>
and
<code>
@vocab
</code>
to
define
<abbr title="Internationalized Resource Identifier">
IRI
</abbr>
prefixes
used
to
resolve
<a class="tref internalDFN" title="relative_iri" href="#dfn-relative_iri">
relative
<del class="diff-old">IRIs.
</del>
<ins class="diff-chg">IRIs
</ins></a>.
It
was
determined
that
this
added
too
much
complexity,
but
the
issue
can
be
re-examined
in
the
future
based
on
community
input.
</p>
</div>
<div id="iri-compaction" class="section">
<h3>
<span class="secno">
3.5
</span>
<abbr title="Internationalized Resource Identifier">
IRI
</abbr>
Compaction
</h3>
<p>
Some
keys
and
values
are
expressed
using
<del class="diff-old">IRIs.
</del>
<a class="tref internalDFN" title="iri" href="#dfn-iri">
<abbr title="Internationalized Resource Identifier">
<ins class="diff-chg">IRI
</ins></abbr></a><ins class="diff-chg">
s.
</ins>
This
section
defines
an
algorithm
for
transforming
an
<abbr title="Internationalized Resource Identifier">
IRI
</abbr>
<ins class="diff-new">(
</ins><em><ins class="diff-new">
iri
</ins></em><ins class="diff-new">
)
</ins>
to
a
<a class="tref internalDFN" title="term" href="#dfn-term">
<ins class="diff-new">term
</ins></a><ins class="diff-new">
or
</ins><a class="tref internalDFN" title="compact_iri" href="#dfn-compact_iri">
compact
<abbr title="Internationalized Resource Identifier">
IRI
</abbr>
</a>
using
the
<a class="tref internalDFN" title="term" href="#dfn-term">
term
</a>
s
specified
in
the
<del class="diff-old">local
</del>
<a class="tref internalDFN" title="active_context" href="#dfn-active_context">
<ins class="diff-chg">active
</ins>
context
<del class="diff-old">.
</del>
</a>
<ins class="diff-chg">using
an
optional
</ins><em><ins class="diff-chg">
value
</ins></em>.
</p>
<div id="iri-compaction-algorithm" class="section">
<h4>
<span class="secno">
<ins class="diff-new">3.5.1
</ins></span><abbr title="Internationalized Resource Identifier"><ins class="diff-new">
IRI
</ins></abbr><ins class="diff-new">
Compaction
Algorithm
</ins></h4>
<p>
The
algorithm
for
generating
a
<del class="diff-old">compacted
</del>
<a class="tref internalDFN" title="compact_iri" href="#dfn-compact_iri">
<ins class="diff-chg">compact
</ins>
<abbr title="Internationalized Resource Identifier">
IRI
</abbr>
</a>
is:
</p>
<ol class="algorithm">
<li>
<del class="diff-old">Search
every
key-value
pair
</del>
<ins class="diff-chg">Create
an
empty
list
of
terms
</ins><em><ins class="diff-chg">
terms
</ins></em><ins class="diff-chg">
that
will
be
populated
with
</ins><a class="tref internalDFN" title="term" href="#dfn-term"><ins class="diff-chg">
term
</ins></a><ins class="diff-chg">
s
that
are
ranked
according
to
how
closely
they
match
</ins><em><ins class="diff-chg">
value
</ins></em>.<ins class="diff-chg">
Initialize
</ins><em><ins class="diff-chg">
highest
rank
</ins></em><ins class="diff-chg">
to
</ins><code><ins class="diff-chg">
0
</ins></code>,<ins class="diff-chg">
and
set
a
flag
</ins><em><ins class="diff-chg">
list
container
</ins></em><ins class="diff-chg">
to
</ins><code><ins class="diff-chg">
false
</ins></code>.</li><li><ins class="diff-chg">
For
each
</ins><em><ins class="diff-chg">
term
</ins></em>
in
the
<a class="tref internalDFN" title="active_context" href="#dfn-active_context">
active
context
<del class="diff-old">for
a
</del>
</a>:
<ol class="algorithm">
<li>
<ins class="diff-chg">If
the
</ins><em>
term
</em>
<ins class="diff-new">'s
</ins><a class="tref internalDFN" title="iri" href="#dfn-iri"><abbr title="Internationalized Resource Identifier"><ins class="diff-new">
IRI
</ins></abbr>
</a>
<del class="diff-old">that
</del>
is
<ins class="diff-new">not
</ins>
a
complete
match
against
<em>
<ins class="diff-new">iri
</ins></em>,<ins class="diff-new">
continue
to
</ins>
the
<del class="diff-old">IRI
.
</del>
<ins class="diff-chg">next
</ins><em><ins class="diff-chg">
term
</ins></em>.</li><li>
If
<del class="diff-old">a
complete
match
</del>
<em>
<ins class="diff-chg">value
</ins></em>
is
<del class="diff-old">found,
</del>
<ins class="diff-chg">a
</ins><a class="tref internalDFN" title="json_object" href="#dfn-json_object"><ins class="diff-chg">
JSON
object
</ins></a><ins class="diff-chg">
containing
only
</ins>
the
<del class="diff-old">resulting
compacted
IRI
</del>
<ins class="diff-chg">property
</ins><code><ins class="diff-chg">
@list
</ins></code>:<ol class="algorithm"><li><ins class="diff-chg">
If
</ins><em><ins class="diff-chg">
term
</ins></em><ins class="diff-chg">
has
a
</ins><code><ins class="diff-chg">
@container
</ins></code><ins class="diff-chg">
set
to
</ins><code><ins class="diff-chg">
@set
</ins></code>,<ins class="diff-chg">
continue
to
the
next
</ins><em><ins class="diff-chg">
term
</ins></em>.</li><li><ins class="diff-chg">
If
</ins><em><ins class="diff-chg">
list
container
</ins></em>
is
<code>
<ins class="diff-new">true
</ins></code><ins class="diff-new">
and
</ins><em><ins class="diff-new">
term
</ins></em><ins class="diff-new">
does
not
have
a
</ins><code><ins class="diff-new">
container
</ins></code><ins class="diff-new">
set
to
</ins><code><ins class="diff-new">
@list
</ins></code>,<ins class="diff-new">
continue
to
</ins>
the
<ins class="diff-chg">next
</ins><em>
term
<del class="diff-old">associated
with
</del>
</em>.
</li>
</ol>
</li>
<li>
<ins class="diff-chg">Otherwise,
if
</ins><em><ins class="diff-chg">
term
</ins></em><ins class="diff-chg">
has
a
</ins><code><ins class="diff-chg">
container
</ins></code><ins class="diff-chg">
set
to
</ins><code><ins class="diff-chg">
@list
</ins></code>,<ins class="diff-chg">
continue
to
</ins>
the
<del class="diff-old">IRI
in
</del>
<ins class="diff-chg">next
</ins><em><ins class="diff-chg">
term
</ins></em>.</li><li><ins class="diff-chg">
Set
</ins><em><ins class="diff-chg">
rank
</ins></em><ins class="diff-chg">
to
</ins>
the
<a class="tref internalDFN" title="term_rank" href="#dfn-term_rank">
<ins class="diff-new">term
rank
</ins></a><ins class="diff-new">
of
</ins><em><ins class="diff-new">
value
</ins></em><ins class="diff-new">
by
passing
passing
</ins><em><ins class="diff-new">
term
</ins></em>,<em><ins class="diff-new">
value
</ins></em>,<ins class="diff-new">
and
</ins>
<a class="tref internalDFN" title="active_context" href="#dfn-active_context">
active
context
</a>
<ins class="diff-new">to
the
</ins><a href="#term-rank-algorithm"><ins class="diff-new">
Term
Rank
Algorithm
</ins>
</a>.
</li>
<li>
If
<em>
<ins class="diff-new">rank
</ins></em><ins class="diff-new">
is
greater
than
</ins><code><ins class="diff-new">
0
</ins></code>:<ol class="algorithm"><li><ins class="diff-new">
If
</ins><em><ins class="diff-new">
term
</ins></em><ins class="diff-new">
has
</ins>
a
<del class="diff-old">complete
match
</del>
<code>
<ins class="diff-chg">container
</ins></code><ins class="diff-chg">
set
to
</ins><code><ins class="diff-chg">
@set
</ins></code>,<ins class="diff-chg">
then
add
</ins><code><ins class="diff-chg">
1
</ins></code><ins class="diff-chg">
to
</ins><em><ins class="diff-chg">
rank
</ins></em>.</li><li><ins class="diff-chg">
If
</ins><em><ins class="diff-chg">
value
</ins></em>
is
<del class="diff-old">not
found,
search
for
</del>
a
<del class="diff-old">partial
match
from
</del>
<a class="tref internalDFN" title="json_object" href="#dfn-json_object">
<ins class="diff-chg">JSON
object
</ins></a><ins class="diff-chg">
containing
only
</ins>
the
<del class="diff-old">beginning
</del>
<ins class="diff-chg">property
</ins><code><ins class="diff-chg">
@list
</ins></code><ins class="diff-chg">
and
</ins><em><ins class="diff-chg">
list
container
</ins></em><ins class="diff-chg">
is
</ins><code><ins class="diff-chg">
false
</ins></code><ins class="diff-chg">
and
</ins><em><ins class="diff-chg">
term
</ins></em><ins class="diff-chg">
has
a
</ins><code><ins class="diff-chg">
container
</ins></code><ins class="diff-chg">
set
to
</ins><code><ins class="diff-chg">
@list
</ins></code>,<ins class="diff-chg">
then
set
</ins><em><ins class="diff-chg">
list
container
</ins></em><ins class="diff-chg">
to
</ins><code><ins class="diff-chg">
true
</ins></code>,<ins class="diff-chg">
clear
</ins><em><ins class="diff-chg">
terms
</ins></em>,<ins class="diff-chg">
set
</ins><em><ins class="diff-chg">
highest
rank
</ins></em><ins class="diff-chg">
to
</ins><em><ins class="diff-chg">
rank
</ins></em>,<ins class="diff-chg">
and
add
</ins><em><ins class="diff-chg">
term
</ins></em><ins class="diff-chg">
to
</ins><em><ins class="diff-chg">
terms
</ins></em>.</li><li><ins class="diff-chg">
Otherwise,
if
</ins><em><ins class="diff-chg">
rank
</ins></em><ins class="diff-chg">
is
greater
than
or
equal
to
</ins><em><ins class="diff-chg">
highest
rank
</ins></em>:<ol class="algorithm"><li><ins class="diff-chg">
If
</ins><em><ins class="diff-chg">
rank
</ins></em><ins class="diff-chg">
is
greater
than
</ins><em><ins class="diff-chg">
highest
rank
</ins></em>,<ins class="diff-chg">
clear
</ins><em><ins class="diff-chg">
terms
</ins></em><ins class="diff-chg">
and
set
</ins><em><ins class="diff-chg">
highest
rank
</ins></em><ins class="diff-chg">
to
</ins><em><ins class="diff-chg">
rank
</ins></em>.</li><li><ins class="diff-chg">
Add
</ins><em><ins class="diff-chg">
term
</ins></em><ins class="diff-chg">
to
</ins><em><ins class="diff-chg">
terms
</ins></em>.</li></ol></li></ol></li></ol></li><li><ins class="diff-chg">
If
</ins><em><ins class="diff-chg">
terms
</ins></em><ins class="diff-chg">
is
empty,
add
a
</ins><a class="tref internalDFN" title="compact_iri" href="#dfn-compact_iri"><ins class="diff-chg">
compact
</ins><abbr title="Internationalized Resource Identifier"><ins class="diff-chg">
IRI
</ins></abbr></a><ins class="diff-chg">
representation
</ins>
of
<em>
<ins class="diff-new">iri
</ins></em><ins class="diff-new">
for
each
</ins><a class="tref internalDFN" title="term" href="#dfn-term"><ins class="diff-new">
term
</ins></a><ins class="diff-new">
in
</ins>
the
<a class="tref internalDFN" title="active_context" href="#dfn-active_context">
<ins class="diff-new">active
context
</ins></a><ins class="diff-new">
which
maps
to
an
</ins><a class="tref internalDFN" title="iri" href="#dfn-iri">
<abbr title="Internationalized Resource Identifier">
IRI
<del class="diff-old">.
For
all
matches
that
are
found,
</del>
</abbr>
</a>
<ins class="diff-chg">which
is
a
prefix
for
</ins><em><ins class="diff-chg">
iri
</ins></em><ins class="diff-chg">
where
</ins>
the
resulting
<del class="diff-old">compacted
</del>
<a class="tref internalDFN" title="compact_iri" href="#dfn-compact_iri">
<ins class="diff-chg">compact
</ins><abbr title="Internationalized Resource Identifier"><ins class="diff-chg">
IRI
</ins></abbr></a><ins class="diff-chg">
is
not
a
</ins><a class="tref internalDFN" title="term" href="#dfn-term"><ins class="diff-chg">
term
</ins></a><ins class="diff-chg">
in
the
</ins><a class="tref internalDFN" title="active_context" href="#dfn-active_context"><ins class="diff-chg">
active
context
</ins></a>.<ins class="diff-chg">
The
resulting
</ins><a class="tref internalDFN" title="compact_iri" href="#dfn-compact_iri"><ins class="diff-chg">
compact
</ins>
<abbr title="Internationalized Resource Identifier">
IRI
</abbr>
</a>
is
the
<a class="tref internalDFN" title="term" href="#dfn-term">
term
</a>
associated
with
the
partially
matched
<abbr title="Internationalized Resource Identifier">
IRI
</abbr>
in
the
<a class="tref internalDFN" title="active_context" href="#dfn-active_context">
active
context
</a>
concatenated
with
a
colon
(:)
character
and
the
unmatched
part
of
<del class="diff-old">the
string.
</del>
<em>
<ins class="diff-chg">iri
</ins></em>.</li><li>
If
<del class="diff-old">there
is
more
than
one
compacted
IRI
produced,
the
final
value
</del>
<em>
<ins class="diff-chg">terms
</ins></em>
is
<ins class="diff-new">empty,
return
</ins><em><ins class="diff-new">
iri
</ins></em>.</li><li><ins class="diff-new">
Return
</ins>
the
shortest
and
lexicographically
least
value
<ins class="diff-new">in
</ins><em><ins class="diff-new">
terms
</ins></em>.</li></ol><p></p></div><div id="term-rank-algorithm" class="section"><h4><span class="secno"><ins class="diff-new">
3.5.2
</ins></span><ins class="diff-new">
Term
Rank
Algorithm
</ins></h4><p><ins class="diff-new">
When
selecting
among
multiple
possible
terms
for
a
given
property,
it
may
be
that
multiple
</ins><a class="tref internalDFN" title="term" href="#dfn-term"><ins class="diff-new">
terms
</ins></a><ins class="diff-new">
are
defined
with
the
same
</ins><a class="tref internalDFN" title="iri" href="#dfn-iri"><abbr title="Internationalized Resource Identifier"><ins class="diff-new">
IRI
</ins></abbr></a>,<ins class="diff-new">
but
differ
in
</ins><code><ins class="diff-new">
@type
</ins></code>,<code><ins class="diff-new">
@container
</ins></code><ins class="diff-new">
or
</ins><code><ins class="diff-new">
@language
</ins></code>.<ins class="diff-new">
The
purpose
</ins>
of
<ins class="diff-new">this
algorithm
is
to
take
an
</ins><a class="tref internalDFN" title="term" href="#dfn-term"><ins class="diff-new">
term
</ins></a><ins class="diff-new">
and
a
value
and
give
it
a
</ins><dfn title="term_rank" id="dfn-term_rank"><ins class="diff-new">
term
rank
</ins></dfn>.<ins class="diff-new">
The
selection
can
then
be
based,
partly,
on
</ins>
the
<del class="diff-old">entire
</del>
<ins class="diff-chg">term
having
the
highest
</ins><a class="tref internalDFN" title="term_rank" href="#dfn-term_rank"><ins class="diff-chg">
term
rank
</ins></a>.</p><p><ins class="diff-chg">
Given
a
</ins><a class="tref internalDFN" title="term" href="#dfn-term"><ins class="diff-chg">
term
</ins></a><em><ins class="diff-chg">
term
</ins></em>,<em><ins class="diff-chg">
value
</ins></em>,<ins class="diff-chg">
and
</ins><a class="tref internalDFN" title="active_context" href="#dfn-active_context"><ins class="diff-chg">
active
context
</ins></a><ins class="diff-chg">
determine
the
</ins><a class="tref internalDFN" title="term_rank" href="#dfn-term_rank"><ins class="diff-chg">
term
rank
</ins></a><ins class="diff-chg">
using
the
following
steps:
</ins></p><ol class="algorithm"><li><ins class="diff-chg">
If
</ins><em><ins class="diff-chg">
value
</ins></em><ins class="diff-chg">
is
</ins><a class="tref internalDFN" title="null" href="#dfn-null"><ins class="diff-chg">
null
</ins></a>,<a class="tref internalDFN" title="term_rank" href="#dfn-term_rank"><ins class="diff-chg">
term
rank
</ins></a><ins class="diff-chg">
is
</ins><code><ins class="diff-chg">
3
</ins></code>.</li><li><ins class="diff-chg">
Otherwise,
if
</ins><em><ins class="diff-chg">
value
</ins></em><ins class="diff-chg">
is
a
</ins><a class="tref internalDFN" title="json_object" href="#dfn-json_object"><ins class="diff-chg">
JSON
object
</ins></a><ins class="diff-chg">
containing
only
the
property
</ins><code><ins class="diff-chg">
@list
</ins></code>:<ol class="algorithm"><li><ins class="diff-chg">
If
the
</ins><code><ins class="diff-chg">
@list
</ins></code><ins class="diff-chg">
property
is
an
empty
array,
if
</ins><em><ins class="diff-chg">
term
</ins></em><ins class="diff-chg">
has
</ins><code><ins class="diff-chg">
@container
</ins></code>
set
<ins class="diff-new">to
</ins><code><ins class="diff-new">
@list
</ins></code>,<a class="tref internalDFN" title="term_rank" href="#dfn-term_rank"><ins class="diff-new">
term
rank
</ins></a><ins class="diff-new">
is
</ins><code><ins class="diff-new">
1
</ins></code>,<ins class="diff-new">
otherwise
</ins><code><ins class="diff-new">
0
</ins></code>.</li><li><ins class="diff-new">
Otherwise,
return
the
sum
</ins>
of
<del class="diff-old">compacted
IRIs.
</del>
<ins class="diff-chg">the
</ins><a class="tref internalDFN" title="term_rank" href="#dfn-term_rank"><ins class="diff-chg">
term
rank
</ins></a><ins class="diff-chg">
s
for
every
entry
in
the
list.
</ins></li></ol></li><li><ins class="diff-chg">
Otherwise,
if
</ins><em><ins class="diff-chg">
value
</ins></em><ins class="diff-chg">
is
</ins><a class="tref internalDFN" title="true" href="#dfn-true"><ins class="diff-chg">
true
</ins></a>,<a class="tref internalDFN" title="false" href="#dfn-false"><ins class="diff-chg">
false
</ins></a>,<ins class="diff-chg">
or
a
</ins><a class="tref internalDFN" title="number" href="#dfn-number"><ins class="diff-chg">
number
</ins></a>,<ins class="diff-chg">
if
</ins><em><ins class="diff-chg">
term
</ins></em><ins class="diff-chg">
has
a
</ins><code><ins class="diff-chg">
@type
</ins></code><ins class="diff-chg">
coercion
to
</ins><code><ins class="diff-chg">
xsd:boolean
</ins></code>,<code><ins class="diff-chg">
xsd:integer
</ins></code>,<ins class="diff-chg">
or
</ins><code><ins class="diff-chg">
xsd:double
</ins></code><ins class="diff-chg">
respectively,
</ins><a class="tref internalDFN" title="term_rank" href="#dfn-term_rank"><ins class="diff-chg">
term
rank
</ins></a><ins class="diff-chg">
is
</ins><code><ins class="diff-chg">
3
</ins></code>,<ins class="diff-chg">
otherwise
if
</ins><em><ins class="diff-chg">
term
</ins></em><ins class="diff-chg">
has
no
</ins><code><ins class="diff-chg">
@type
</ins></code><ins class="diff-chg">
or
</ins><code><ins class="diff-chg">
@language
</ins></code><ins class="diff-chg">
it
is
</ins><code><ins class="diff-chg">
2
</ins></code>,<ins class="diff-chg">
otherwise
</ins><code><ins class="diff-chg">
1
</ins></code>.</li><li><ins class="diff-chg">
Otherwise,
if
</ins><em><ins class="diff-chg">
value
</ins></em><ins class="diff-chg">
is
a
</ins><a class="tref internalDFN" title="string" href="#dfn-string"><ins class="diff-chg">
string
</ins></a>,<ins class="diff-chg">
it
represents
a
string
value
with
no
</ins><code><ins class="diff-chg">
@language
</ins></code>.<ins class="diff-chg">
If
</ins><em><ins class="diff-chg">
term
</ins></em><ins class="diff-chg">
has
</ins><code><ins class="diff-chg">
@language
</ins></code><a class="tref internalDFN" title="null" href="#dfn-null"><ins class="diff-chg">
null
</ins></a>,<ins class="diff-chg">
or
</ins><em><ins class="diff-chg">
term
</ins></em><ins class="diff-chg">
has
no
</ins><code><ins class="diff-chg">
@type
</ins></code><ins class="diff-chg">
or
</ins><code><ins class="diff-chg">
@language
</ins></code><ins class="diff-chg">
and
the
</ins><a class="tref internalDFN" title="active_context" href="#dfn-active_context"><ins class="diff-chg">
active
context
</ins></a><ins class="diff-chg">
has
no
</ins><code><ins class="diff-chg">
@language
</ins></code>,<a class="tref internalDFN" title="term_rank" href="#dfn-term_rank"><ins class="diff-chg">
term
rank
</ins></a><ins class="diff-chg">
is
</ins><code><ins class="diff-chg">
3
</ins></code>,<ins class="diff-chg">
otherwise
</ins><code><ins class="diff-chg">
0
</ins></code>.</li><li><ins class="diff-chg">
Otherwise,
</ins><em><ins class="diff-chg">
value
</ins></em><em class="rfc2119" title="must"><ins class="diff-chg">
must
</ins></em><ins class="diff-chg">
be
a
</ins><a class="tref internalDFN" title="subject_definition" href="#dfn-subject_definition"><ins class="diff-chg">
subject
definition
</ins></a>,<a class="tref internalDFN" title="subject_reference" href="#dfn-subject_reference"><ins class="diff-chg">
subject
reference
</ins></a>,<ins class="diff-chg">
or
a
</ins><a class="tref internalDFN" title="json_object" href="#dfn-json_object"><ins class="diff-chg">
JSON
object
</ins></a><ins class="diff-chg">
having
a
</ins><code><ins class="diff-chg">
@value
</ins></code>.<ol class="algorithm"><li><ins class="diff-chg">
If
</ins><em><ins class="diff-chg">
value
</ins></em><ins class="diff-chg">
has
an
</ins><code><ins class="diff-chg">
@value
</ins></code><ins class="diff-chg">
property,
it
must
have
either
a
</ins><code><ins class="diff-chg">
@type
</ins></code><ins class="diff-chg">
or
a
</ins><code><ins class="diff-chg">
@language
</ins></code>:<ol class="algorithm"><li><ins class="diff-chg">
If
</ins><em><ins class="diff-chg">
value
</ins></em><ins class="diff-chg">
has
a
</ins><code><ins class="diff-chg">
@type
</ins></code><ins class="diff-chg">
property
matching
a
</ins><code><ins class="diff-chg">
@type
</ins></code><ins class="diff-chg">
coercion
for
</ins><em><ins class="diff-chg">
term
</ins></em>,<a class="tref internalDFN" title="term_rank" href="#dfn-term_rank"><ins class="diff-chg">
term
rank
</ins></a><ins class="diff-chg">
is
</ins><code><ins class="diff-chg">
3
</ins></code>,<ins class="diff-chg">
otherwise
if
</ins><em><ins class="diff-chg">
term
</ins></em><ins class="diff-chg">
has
no
</ins><code><ins class="diff-chg">
@type
</ins></code><ins class="diff-chg">
coersion
and
no
</ins><code><ins class="diff-chg">
@language
</ins></code>,<a class="tref internalDFN" title="term_rank" href="#dfn-term_rank"><ins class="diff-chg">
term
rank
</ins></a><ins class="diff-chg">
is
</ins><code><ins class="diff-chg">
1
</ins></code>,<ins class="diff-chg">
otherwise
</ins><code><ins class="diff-chg">
0
</ins></code>.</li><li><ins class="diff-chg">
Otherwise,
if
</ins><em><ins class="diff-chg">
value
</ins></em><ins class="diff-chg">
has
a
</ins><code><ins class="diff-chg">
@language
</ins></code><ins class="diff-chg">
property
matching
a
</ins><code><ins class="diff-chg">
@language
</ins></code><ins class="diff-chg">
definition
for
</ins><em><ins class="diff-chg">
term
</ins></em><ins class="diff-chg">
(or
</ins><em><ins class="diff-chg">
term
</ins></em><ins class="diff-chg">
has
no
</ins><code><ins class="diff-chg">
@type
</ins></code><ins class="diff-chg">
or
</ins><code><ins class="diff-chg">
@language
</ins></code><ins class="diff-chg">
definition
and
</ins><code><ins class="diff-chg">
@language
</ins></code><ins class="diff-chg">
in
the
</ins><a class="tref internalDFN" title="active_context" href="#dfn-active_context"><ins class="diff-chg">
active
context
</ins></a><ins class="diff-chg">
matches
the
</ins><em><ins class="diff-chg">
value
</ins></em><code><ins class="diff-chg">
@language
</ins></code><ins class="diff-chg">
),
</ins><a class="tref internalDFN" title="term_rank" href="#dfn-term_rank"><ins class="diff-chg">
term
rank
</ins></a><ins class="diff-chg">
is
</ins><code><ins class="diff-chg">
3
</ins></code>,<ins class="diff-chg">
otherwise
if
</ins><em><ins class="diff-chg">
term
</ins></em><ins class="diff-chg">
has
no
</ins><code><ins class="diff-chg">
@type
</ins></code><ins class="diff-chg">
coersion
and
no
</ins><code><ins class="diff-chg">
@language
</ins></code>,<a class="tref internalDFN" title="term_rank" href="#dfn-term_rank"><ins class="diff-chg">
term
rank
</ins></a><ins class="diff-chg">
is
</ins><code><ins class="diff-chg">
1
</ins></code>,<ins class="diff-chg">
otherwise
</ins><code><ins class="diff-chg">
0
</ins></code>.</li></ol></li><li><ins class="diff-chg">
Otherwise,
if
</ins><em><ins class="diff-chg">
term
</ins></em><ins class="diff-chg">
has
</ins><code><ins class="diff-chg">
@type
</ins></code><ins class="diff-chg">
coerced
to
</ins><code><ins class="diff-chg">
@id
</ins></code>,<a class="tref internalDFN" title="term_rank" href="#dfn-term_rank"><ins class="diff-chg">
term
rank
</ins></a><ins class="diff-chg">
is
</ins><code><ins class="diff-chg">
3
</ins></code>,<ins class="diff-chg">
otherwise
if
</ins><em><ins class="diff-chg">
term
</ins></em><ins class="diff-chg">
has
no
</ins><code><ins class="diff-chg">
@type
</ins></code><ins class="diff-chg">
coersion
and
no
</ins><code><ins class="diff-chg">
@language
</ins></code>,<a class="tref internalDFN" title="term_rank" href="#dfn-term_rank"><ins class="diff-chg">
term
rank
</ins></a><ins class="diff-chg">
is
</ins><code><ins class="diff-chg">
1
</ins></code>,<ins class="diff-chg">
otherwise
</ins><code><ins class="diff-chg">
0
</ins></code>.</li></ol></li><li><ins class="diff-chg">
Return
</ins><a class="tref internalDFN" title="term_rank" href="#dfn-term_rank"><ins class="diff-chg">
term
rank
</ins></a>.
</li>
</ol>
</div>
</div>
<div id="value-expansion" class="section">
<h3>
<span class="secno">
3.6
</span>
Value
Expansion
</h3>
<p>
Some
values
in
JSON-LD
can
be
expressed
in
a
compact
form.
These
values
are
required
to
be
expanded
at
times
when
processing
JSON-LD
documents.
</p>
<p>
The
algorithm
for
expanding
a
<em>
value
</em>
takes
an
<a class="tref internalDFN" title="active_property" href="#dfn-active_property">
active
property
</a>
and
<a class="tref internalDFN" title="active_context" href="#dfn-active_context">
active
context
</a>.
It
is
implemented
as
follows:
</p>
<ol class="algorithm">
<li>
If
<em>
value
</em>
is
<del class="diff-old">true
,
false
or
</del>
<ins class="diff-chg">a
</ins>
<a class="tref internalDFN" title="number" href="#dfn-number">
number
<del class="diff-old">,
</del>
</a>
<ins class="diff-chg">and
the
</ins><a class="tref internalDFN" title="active_property" href="#dfn-active_property"><ins class="diff-chg">
active
property
</ins></a><ins class="diff-chg">
is
the
target
of
typed
literal
coercion
to
</ins><code><ins class="diff-chg">
xsd:integer
</ins></code><ins class="diff-chg">
or
</ins><code><ins class="diff-chg">
xsd:double
</ins></code>,
expand
the
value
<del class="diff-old">by
adding
a
</del>
<ins class="diff-chg">into
an
object
with
</ins>
two
<del class="diff-old">new
</del>
key-value
pairs.
The
first
key-value
pair
will
be
<code>
@value
</code>
and
the
string
representation
of
<em>
value
<del class="diff-old">.
</del>
</em>
<ins class="diff-chg">as
defined
in
the
section
</ins><a href="#data-round-tripping"><ins class="diff-chg">
Data
Round
Tripping
</ins></a>.
The
second
key-value
pair
will
be
<code>
<del class="diff-old">@type&gt;
,
</del>
<ins class="diff-chg">@type
</ins></code>
and
the
<ins class="diff-new">associated
coercion
datatype
</ins>
expanded
<del class="diff-old">version
of
xsd:boolean
,
xsd:integer
,
or
xsd:double
,
depending
on
value
.
</del>
<ins class="diff-chg">according
to
the
</ins><a href="#iri-expansion"><abbr title="Internationalized Resource Identifier"><ins class="diff-chg">
IRI
</ins></abbr><ins class="diff-chg">
Expansion
</ins></a><ins class="diff-chg">
rules.
</ins>
</li>
<li>
Otherwise,
if
<a class="tref internalDFN" title="active_property" href="#dfn-active_property">
active
property
</a>
is
<code>
<ins class="diff-new">@graph
</ins></code>,<ins class="diff-new">
or
</ins>
the
target
of
an
<code>
@id
</code>
coercion,
expand
the
value
<del class="diff-old">by
adding
</del>
<ins class="diff-chg">into
an
object
with
</ins>
a
<del class="diff-old">new
</del>
key-value
pair
where
the
key
is
<code>
@id
</code>
and
the
value
is
the
expanded
<abbr title="Internationalized Resource Identifier">
IRI
</abbr>
according
to
the
<a href="#iri-expansion">
<abbr title="Internationalized Resource Identifier">
IRI
</abbr>
Expansion
</a>
rules.
</li>
<li>
Otherwise,
if
<a class="tref internalDFN" title="active_property" href="#dfn-active_property">
active
property
</a>
is
the
target
of
typed
literal
coercion,
expand
<em>
value
</em>
<del class="diff-old">by
adding
two
new
</del>
<ins class="diff-chg">into
an
object
with
</ins>
key-value
pairs.
The
first
key-value
pair
will
be
<code>
@value
</code>
and
the
unexpanded
<del class="diff-old">value.
</del>
<em>
<ins class="diff-chg">value
</ins></em>.
The
second
key-value
pair
will
be
<code>
@type
</code>
and
the
associated
coercion
datatype
expanded
according
to
the
<a href="#iri-expansion">
<abbr title="Internationalized Resource Identifier">
IRI
</abbr>
Expansion
</a>
rules.
</li>
<li>
Otherwise,
if
<em>
<ins class="diff-new">value
</ins></em><ins class="diff-new">
is
a
</ins><a class="tref internalDFN" title="string" href="#dfn-string"><ins class="diff-new">
string
</ins></a><ins class="diff-new">
and
</ins>
the
<a class="tref internalDFN" title="active_property" href="#dfn-active_property">
active
<del class="diff-old">context
</del>
<ins class="diff-chg">property
</ins>
</a>
<del class="diff-old">has
a
@language
,
</del>
<ins class="diff-chg">is
not
the
target
of
typed
literal
coercion
but
target
of
language
tagging,
</ins>
expand
<em>
value
</em>
<del class="diff-old">by
adding
</del>
<ins class="diff-chg">into
an
object
with
</ins>
two
<del class="diff-old">new
</del>
key-value
pairs.
The
first
key-value
pair
will
be
<code>
@value
</code>
and
the
unexpanded
<del class="diff-old">value.
</del>
<em>
<ins class="diff-chg">value
</ins></em>.
The
second
key-value
pair
will
be
<code>
@language
</code>
and
value
of
<del class="diff-old">@language
</del>
<ins class="diff-chg">the
language
tagging
</ins>
from
the
<a class="tref internalDFN" title="active_context" href="#dfn-active_context">
active
context
</a>.
</li>
<li>
Otherwise,
<em>
value
</em>
is
already
expanded.
</li>
</ol>
</div>
<div id="value-compaction" class="section">
<h3>
<span class="secno">
3.7
</span>
Value
Compaction
</h3>
<p>
Some
values,
such
as
IRIs
and
typed
literals,
may
be
expressed
in
an
expanded
form
in
JSON-LD.
These
values
are
required
to
be
compacted
at
times
when
processing
JSON-LD
documents.
</p>
<p>
The
algorithm
for
compacting
an
expanded
value
<em>
value
</em>
takes
an
<a class="tref internalDFN" title="active_property" href="#dfn-active_property">
active
property
</a>
and
<a class="tref internalDFN" title="active_context" href="#dfn-active_context">
active
context
</a>.
It
is
implemented
as
follows:
</p>
<ol class="algorithm">
<li>
If
the
value
may
be
expressed
as
<a class="tref internalDFN" title="true" href="#dfn-true">
true
</a>,
<a class="tref internalDFN" title="false" href="#dfn-false">
false
</a>
or
<a class="tref internalDFN" title="number" href="#dfn-number">
number
</a>,
the
value
is
the
native
representation
of
the
<code>
@value
</code>
value.
</li>
<li>
<ins class="diff-new">If
</ins><a class="tref internalDFN" title="active_property" href="#dfn-active_property"><ins class="diff-new">
active
property
</ins></a><ins class="diff-new">
is
</ins><code><ins class="diff-new">
@graph
</ins></code>,<ins class="diff-new">
the
compacted
value
is
the
value
associated
with
the
</ins><code><ins class="diff-new">
@id
</ins></code><ins class="diff-new">
key,
processed
according
to
the
</ins><a href="#iri-compaction"><abbr title="Internationalized Resource Identifier"><ins class="diff-new">
IRI
</ins></abbr><ins class="diff-new">
Compaction
</ins></a><ins class="diff-new">
steps.
</ins></li><li>
Otherwise,
if
the
<a class="tref internalDFN" title="active_context" href="#dfn-active_context">
active
context
</a>
contains
a
coercion
target
for
the
key
that
matches
the
expression
of
the
value,
compact
the
value
using
the
following
steps:
<ol class="algorithm">
<li>
If
the
coercion
target
is
an
<code>
@id
</code>,
the
compacted
value
is
the
value
associated
with
the
<code>
@id
</code>
key,
processed
according
to
the
<a href="#iri-compaction">
<abbr title="Internationalized Resource Identifier">
IRI
</abbr>
Compaction
</a>
steps.
</li>
<li>
If
the
coercion
target
is
a
typed
literal,
the
compacted
value
is
the
value
associated
with
the
<code>
@value
</code>
key.
</li>
</ol>
</li>
<li>
Otherwise,
if
<em>
value
</em>
contains
an
<code>
@id
</code>
key,
the
compacted
value
is
<em>
value
</em>
with
the
value
of
<code>
@id
</code>
processed
according
to
the
<a href="#iri-compaction">
<abbr title="Internationalized Resource Identifier">
IRI
</abbr>
Compaction
</a>
steps.
</li>
<li>
Otherwise,
if
the
<a class="tref internalDFN" title="active_context" href="#dfn-active_context">
active
context
</a>
contains
a
<code>
@language
</code>,
which
matches
the
<code>
@language
</code>
of
the
value,
or
the
value
has
only
a
<code>
@value
</code>
key,
the
compacted
value
is
the
value
associated
with
the
<code>
@value
</code>
key.
</li>
<li>
Otherwise,
if
the
value
contains
a
<code>
@type
</code>
key,
the
compacted
value
is
<em>
value
</em>
with
the
<code>
@type
</code>
value
processed
according
to
the
<a href="#iri-compaction">
<abbr title="Internationalized Resource Identifier">
IRI
</abbr>
Compaction
</a>
steps.
</li>
<li>
Otherwise,
the
value
is
not
modified.
</li>
</ol>
</div>
<div id="generate-blank-node-identifier" class="section">
<h3>
<span class="secno">
3.8
</span>
<ins class="diff-new">Generate
Blank
Node
Identifier
</ins></h3><p><ins class="diff-new">
This
algorithm
is
used
by
the
</ins><a href="#framing-algorithm"><ins class="diff-new">
Framing
Algorithm
</ins></a><ins class="diff-new">
and
</ins><a href="#convert-from-rdf-algorithm"><ins class="diff-new">
Convert
From
RDF
Algorithm
</ins></a><ins class="diff-new">
to
deterministicly
name
</ins><a class="tref internalDFN" title="blank_node" href="#dfn-blank_node"><ins class="diff-new">
blank
node
</ins></a><ins class="diff-new">
identifiers.
It
uses
a
</ins><em><ins class="diff-new">
identifier
map
</ins></em><ins class="diff-new">
and
</ins><em><ins class="diff-new">
prefix
</ins></em><ins class="diff-new">
and
takes
a
possibly
</ins><a class="tref internalDFN" title="null" href="#dfn-null"><ins class="diff-new">
null
</ins></a><ins class="diff-new">
identifier
and
returns
a
new
identifier
based
on
</ins><em><ins class="diff-new">
prefix
</ins></em>.</p><p><ins class="diff-new">
The
variable
</ins><em><ins class="diff-new">
next
identifier
</ins></em><ins class="diff-new">
is
initialized
to
</ins><em><ins class="diff-new">
prefix
</ins></em><ins class="diff-new">
appended
with
</ins><code><ins class="diff-new">
0
</ins></code>.</p><ol class="algorithm"><li><ins class="diff-new">
If
the
old
identifier
is
not
null
and
is
in
</ins><em><ins class="diff-new">
identifier
map
</ins></em><ins class="diff-new">
return
the
mapped
identifier.
</ins></li><li><ins class="diff-new">
Otherwise,
if
old
identifier
is
not
null,
create
a
new
entry
in
</ins><em><ins class="diff-new">
identifier
map
</ins></em><ins class="diff-new">
initialized
to
the
current
value
of
</ins><em><ins class="diff-new">
next
identifier
</ins></em>.<ins class="diff-new">
Increment
</ins><em><ins class="diff-new">
next
identifier
</ins></em><ins class="diff-new">
by
adding
one
to
the
integer
suffix.
Return
the
mapped
identifier.
</ins></li><li><ins class="diff-new">
Otherwise,
increment
</ins><em><ins class="diff-new">
next
identifier
</ins></em><ins class="diff-new">
by
adding
one
to
the
integer
suffix
and
return
its
original
value.
</ins></li></ol></div><div id="expansion" class="section"><h3><span class="secno"><ins class="diff-new">
3.9
</ins></span>
Expansion
</h3>
<p>
Expansion
is
the
process
of
taking
a
JSON-LD
document
and
applying
a
context
such
that
all
<abbr title="Internationalized Resource Identifier">
IRI
</abbr>,
datatypes,
and
literal
values
are
expanded
so
that
the
context
is
no
longer
necessary.
JSON-LD
document
expansion
is
typically
used
as
a
part
of
<a href="#framing">
Framing
<del class="diff-old">or
Normalization
</del>
</a>.
</p>
<p>
For
example,
assume
the
following
JSON-LD
input
document:
</p>
<pre class="example">{
   &quot;@context&quot;:
   {
      &quot;name&quot;: &quot;http://xmlns.com/foaf/0.1/name&quot;,
      &quot;homepage&quot;: {
        &quot;@id&quot;: &quot;http://xmlns.com/foaf/0.1/homepage&quot;,
        &quot;@type&quot;, &quot;@id&quot;
      }
   },
   &quot;name&quot;: &quot;Manu Sporny&quot;,
   &quot;homepage&quot;: &quot;http://manu.sporny.org/&quot;
}
</pre>
<p>
Running
the
JSON-LD
Expansion
algorithm
against
the
JSON-LD
input
document
provided
above
would
result
in
the
following
output:
</p>
<pre class="example">{
   &quot;http://xmlns.com/foaf/0.1/name&quot;: &quot;Manu Sporny&quot;,
   &quot;http://xmlns.com/foaf/0.1/homepage&quot;: {
      &quot;@id&quot;: &quot;http://manu.sporny.org/&quot;
   }
}
</pre>
<div id="expansion-algorithm" class="section">
<h4>
<span class="secno">
<del class="diff-old">3.8.1
</del>
<ins class="diff-chg">3.9.1
</ins>
</span>
Expansion
Algorithm
</h4>
<p>
The
algorithm
takes
three
input
variables:
an
<a class="tref internalDFN" title="active_context" href="#dfn-active_context">
active
context
</a>,
an
<a class="tref internalDFN" title="active_property" href="#dfn-active_property">
active
property
</a>,
and
<del class="diff-old">a
</del>
<ins class="diff-chg">an
</ins>
<em>
<del class="diff-old">value
</del>
<ins class="diff-chg">element
</ins>
</em>
to
be
expanded.
To
begin,
the
<a class="tref internalDFN" title="active_context" href="#dfn-active_context">
active
context
</a>
is
set
to
the
<a class="tref internalDFN" title="initial_context" href="#dfn-initial_context">
initial
context
</a>,
<a class="tref internalDFN" title="active_property" href="#dfn-active_property">
active
property
</a>
is
set
to
<del class="diff-old">nil,
</del>
<a class="tref internalDFN" title="null" href="#dfn-null">
<ins class="diff-chg">null
</ins></a>,
and
<em>
<del class="diff-old">value
</del>
<ins class="diff-chg">element
</ins>
</em>
is
set
to
the
<a class="tref internalDFN" title="json-ld_input" href="#dfn-json-ld_input">
JSON-LD
input
</a>.
</p>
<ol class="algorithm">
<li>
If
<em>
<del class="diff-old">value
</del>
<ins class="diff-chg">element
</ins>
</em>
is
an
<a class="tref internalDFN" title="array" href="#dfn-array">
array
</a>,
process
each
<del class="diff-old">item
</del>
<ins class="diff-chg">entry
</ins>
in
<em>
<del class="diff-old">value
</del>
<ins class="diff-chg">element
</ins>
</em>
recursively
using
this
algorithm,
passing
copies
of
the
<a class="tref internalDFN" title="active_context" href="#dfn-active_context">
active
context
</a>
and
<a class="tref internalDFN" title="active_property" href="#dfn-active_property">
active
property
</a>.
<ins class="diff-new">If
has
a
</ins><code><ins class="diff-new">
@container
</ins></code><ins class="diff-new">
set
to
</ins><code><ins class="diff-new">
@list
</ins></code><ins class="diff-new">
and
any
entry
in
</ins><em><ins class="diff-new">
element
</ins></em><ins class="diff-new">
is
an
</ins><a class="tref internalDFN" title="array" href="#dfn-array"><ins class="diff-new">
array
</ins></a>,<ins class="diff-new">
or
is
a
</ins><a class="tref internalDFN" title="json_object" href="#dfn-json_object"><ins class="diff-new">
JSON
object
</ins></a><ins class="diff-new">
containing
a
</ins><code><ins class="diff-new">
@list
</ins></code><ins class="diff-new">
property,
throw
an
exception,
as
lists
of
lists
are
not
allowed.
If
the
expanded
entry
is
null,
drop
it.
If
it's
an
array,
merge
it's
entries
with
</ins><em><ins class="diff-new">
element
</ins></em><ins class="diff-new">
's
entries.
</ins>
</li>
<li>
Otherwise,
if
<em>
<del class="diff-old">value
</del>
<ins class="diff-chg">element
</ins>
</em>
is
an
object
<ol class="algorithm">
<li>
<del class="diff-old">Update
</del>
<ins class="diff-chg">If
</ins><em><ins class="diff-chg">
element
</ins></em><ins class="diff-chg">
has
a
</ins><code><ins class="diff-chg">
@context
</ins></code><ins class="diff-chg">
property,
update
</ins>
the
<a class="tref internalDFN" title="active_context" href="#dfn-active_context">
active
context
</a>
according
to
the
steps
outlined
in
<del class="diff-old">the
context
</del>
<a href="#context-processing">
<ins class="diff-chg">Context
Processing
</ins>
</a>
<del class="diff-old">section
</del>
and
remove
<del class="diff-old">it
from
</del>
the
<del class="diff-old">expanded
result.
</del>
<code>
<ins class="diff-chg">@context
</ins></code><ins class="diff-chg">
property.
</ins>
</li>
<li>
<del class="diff-old">For
</del>
<ins class="diff-chg">Then,
proceed
and
process
</ins>
each
<del class="diff-old">key
</del>
<em>
<ins class="diff-chg">property
</ins></em>
and
<em>
value
</em>
in
<em>
<del class="diff-old">value
:
</del>
<ins class="diff-chg">element
</ins></em><ins class="diff-chg">
as
follows:
</ins>
<ol class="algorithm">
<li>
<ins class="diff-new">Remove
</ins><em><ins class="diff-new">
property
</ins></em><ins class="diff-new">
from
</ins><em><ins class="diff-new">
element
</ins></em>,<ins class="diff-new">
expand
</ins><em><ins class="diff-new">
property
</ins></em><ins class="diff-new">
according
to
the
steps
outlined
in
</ins><a href="#iri-expansion"><abbr title="Internationalized Resource Identifier"><ins class="diff-new">
IRI
</ins></abbr><ins class="diff-new">
Expansion
</ins></a>.<ins class="diff-new">
Set
the
</ins><a class="tref internalDFN" title="active_property" href="#dfn-active_property"><ins class="diff-new">
active
property
</ins></a><ins class="diff-new">
to
the
original
un-expanded
</ins><em><ins class="diff-new">
property
</ins></em><ins class="diff-new">
if
</ins><em><ins class="diff-new">
property
</ins></em><ins class="diff-new">
is
not
a
</ins><a class="tref internalDFN" title="keyword" href="#dfn-keyword"><ins class="diff-new">
keyword
</ins></a>.</li><li>
If
<em>
<ins class="diff-new">property
</ins></em><ins class="diff-new">
does
not
expand
to
a
keyword
or
an
</ins><a class="tref internalDFN" title="absolute_iri" href="#dfn-absolute_iri"><ins class="diff-new">
absolute
</ins><abbr title="Internationalized Resource Identifier"><ins class="diff-new">
IRI
</ins></abbr></a><ins class="diff-new">
(i.e.,
it
doesn't
contain
a
colon),
continue
with
</ins>
the
<del class="diff-old">key
</del>
<ins class="diff-chg">next
property
from
</ins><em><ins class="diff-chg">
element
</ins></em>.</li><li><ins class="diff-chg">
If
</ins><em><ins class="diff-chg">
value
</ins></em><ins class="diff-chg">
is
</ins><a class="tref internalDFN" title="null" href="#dfn-null"><ins class="diff-chg">
null
</ins></a><ins class="diff-chg">
and
</ins><em><ins class="diff-chg">
property
</ins></em>
is
<ins class="diff-new">not
</ins>
<code>
<del class="diff-old">@id
or
</del>
<ins class="diff-chg">@value
</ins></code>,<ins class="diff-chg">
continue
with
the
next
property
from
</ins><em><ins class="diff-chg">
element
</ins></em>.</li><li><ins class="diff-chg">
If
the
</ins><em><ins class="diff-chg">
property
</ins></em><ins class="diff-chg">
is
</ins>
<code>
<del class="diff-old">@type
</del>
<ins class="diff-chg">@id
</ins>
</code>
<del class="diff-old">and
</del>
the
<em>
value
<del class="diff-old">is
</del>
</em>
<em class="rfc2119" title="must">
<ins class="diff-chg">must
</ins></em><ins class="diff-chg">
be
</ins>
a
<a class="tref internalDFN" title="string" href="#dfn-string">
string
<del class="diff-old">,
expand
</del>
</a>.
<ins class="diff-chg">Expand
</ins>
the
<em>
value
</em>
according
to
<a href="#iri-expansion">
<abbr title="Internationalized Resource Identifier">
IRI
</abbr>
Expansion
</a>.
</li>
<li>
Otherwise,
if
the
<del class="diff-old">key
</del>
<em>
<ins class="diff-chg">property
</ins></em>
is
<code>
<del class="diff-old">@value
,
the
</del>
<ins class="diff-chg">@type
</ins></code>:<ol class="algorithm"><li><ins class="diff-chg">
If
</ins><em>
value
<del class="diff-old">must
</del>
</em>
<del class="diff-old">be
</del>
<ins class="diff-chg">is
</ins>
a
<a class="tref internalDFN" title="string" href="#dfn-string">
string
<del class="diff-old">and
is
not
subject
</del>
</a>,
<ins class="diff-chg">expand
according
</ins>
to
<del class="diff-old">further
expansion.
</del>
<a href="#iri-expansion">
<abbr title="Internationalized Resource Identifier">
<ins class="diff-chg">IRI
</ins></abbr><ins class="diff-chg">
Expansion
</ins></a>.
</li>
<li>
Otherwise,
if
<del class="diff-old">the
key
</del>
<em>
<ins class="diff-chg">value
</ins></em>
is
<del class="diff-old">not
</del>
a
<del class="diff-old">keyword
</del>
<a class="tref internalDFN" title="subject_reference" href="#dfn-subject_reference">
<ins class="diff-chg">subject
reference
</ins>
</a>,
<del class="diff-old">expand
</del>
the
<del class="diff-old">key
according
to
</del>
<ins class="diff-chg">expanded
value
is
the
result
of
performing
</ins>
<a href="#iri-expansion">
<abbr title="Internationalized Resource Identifier">
IRI
</abbr>
Expansion
</a>
<del class="diff-old">rules
and
set
as
active
property
.
</del>
<ins class="diff-chg">on
the
value
of
</ins><code><ins class="diff-chg">
@id
</ins></code>.
</li>
<li>
<del class="diff-old">If
the
</del>
<ins class="diff-chg">Otherwise,
if
</ins><em>
value
</em>
<ins class="diff-new">is
a
</ins><a class="tref internalDFN" title="json_object" href="#dfn-json_object"><ins class="diff-new">
JSON
Object
</ins></a>,<ins class="diff-new">
it
must
be
empty
(used
for
</ins><a href="#framing"><ins class="diff-new">
Framing
</ins></a><ins class="diff-new">
).
</ins></li><li><ins class="diff-new">
Otherwise,
if
</ins><em><ins class="diff-new">
value
</ins></em>
is
an
<a class="tref internalDFN" title="array" href="#dfn-array">
array
</a>,
<del class="diff-old">and
active
property
</del>
<ins class="diff-chg">all
elements
must
be
either
a
</ins><a class="tref internalDFN" title="string" href="#dfn-string"><ins class="diff-chg">
string
</ins>
</a>
<del class="diff-old">is
</del>
<ins class="diff-chg">or
</ins><a class="tref internalDFN" title="subject_reference" href="#dfn-subject_reference">
subject
<del class="diff-old">to
@list
expansion,
replace
the
</del>
<ins class="diff-chg">reference
</ins></a>.<ins class="diff-chg">
Expand
</ins><em>
value
<del class="diff-old">with
a
new
key-value
key
where
</del>
</em>
<ins class="diff-chg">for
each
of
it's
entries
using
</ins>
the
<del class="diff-old">key
</del>
<ins class="diff-chg">previous
three
steps.
</ins></li></ol></li><li><ins class="diff-chg">
Otherwise,
if
the
</ins><em><ins class="diff-chg">
property
</ins></em>
is
<code>
<del class="diff-old">@list
</del>
<ins class="diff-chg">@value
</ins></code><ins class="diff-chg">
or
</ins><code><ins class="diff-chg">
@language
</ins>
</code>
<del class="diff-old">and
value
set
to
the
current
value.
If
</del>
the
<em>
value
<del class="diff-old">is
</del>
</em>
<em class="rfc2119" title="must not">
<ins class="diff-chg">must
not
</ins></em><ins class="diff-chg">
be
a
</ins><a class="tref internalDFN" title="json_object" href="#dfn-json_object"><ins class="diff-chg">
JSON
object
</ins></a><ins class="diff-chg">
or
</ins>
an
<a class="tref internalDFN" title="array" href="#dfn-array">
array
<del class="diff-old">,
process
each
item
in
</del>
</a>.
</li>
<li>
<ins class="diff-chg">Otherwise,
if
</ins>
the
<del class="diff-old">array
</del>
<em>
<ins class="diff-chg">property
</ins></em><ins class="diff-chg">
is
</ins><code><ins class="diff-chg">
@list
</ins></code>,<code><ins class="diff-chg">
@set
</ins></code>,<ins class="diff-chg">
or
</ins><code><ins class="diff-chg">
@graph
</ins></code>,<ins class="diff-chg">
expand
</ins><em><ins class="diff-chg">
value
</ins></em>
recursively
using
this
algorithm,
passing
copies
of
the
<a class="tref internalDFN" title="active_context" href="#dfn-active_context">
active
context
</a>
and
<em>
active
property
<del class="diff-old">.
</del>
</em>.
If
the
<ins class="diff-new">expanded
</ins><em>
value
</em>
is
<ins class="diff-new">not
</ins>
an
<del class="diff-old">object,
process
the
</del>
<a class="tref internalDFN" title="array" href="#dfn-array">
<ins class="diff-chg">array
</ins></a>,<ins class="diff-chg">
convert
it
to
an
</ins><a class="tref internalDFN" title="array" href="#dfn-array"><ins class="diff-chg">
array
</ins></a>.<ins class="diff-chg">
If
</ins><em><ins class="diff-chg">
property
</ins></em><ins class="diff-chg">
is
</ins><code><ins class="diff-chg">
@list
</ins></code><ins class="diff-chg">
and
any
entry
in
</ins><em><ins class="diff-chg">
value
</ins></em><ins class="diff-chg">
is
a
</ins><a class="tref internalDFN" title="json_object" href="#dfn-json_object"><ins class="diff-chg">
JSON
</ins>
object
</a>
<ins class="diff-new">containing
an
</ins><code><ins class="diff-new">
@list
</ins></code><ins class="diff-new">
property,
throw
an
exception,
as
lists
of
lists
are
not
supported.
</ins></li><li><ins class="diff-new">
Otherwise,
expand
</ins><em><ins class="diff-new">
value
</ins></em>
recursively
using
this
algorithm,
passing
copies
of
the
<a class="tref internalDFN" title="active_context" href="#dfn-active_context">
active
context
</a>
and
<a class="tref internalDFN" title="active_property" href="#dfn-active_property">
active
property
</a>.
</li>
<li>
<del class="diff-old">Otherwise,
expand
</del>
<ins class="diff-chg">If
</ins><em><ins class="diff-chg">
property
</ins></em><ins class="diff-chg">
is
not
a
keyword
and
</ins><a class="tref internalDFN" title="active_property" href="#dfn-active_property"><ins class="diff-chg">
active
property
</ins></a><ins class="diff-chg">
has
a
</ins><code><ins class="diff-chg">
@container
</ins></code><code><ins class="diff-chg">
@list
</ins></code><ins class="diff-chg">
and
</ins>
the
<ins class="diff-new">expanded
</ins><em>
value
<del class="diff-old">according
</del>
</em>
<ins class="diff-chg">is
not
</ins><a class="tref internalDFN" title="null" href="#dfn-null"><ins class="diff-chg">
null
</ins></a>,<ins class="diff-chg">
convert
</ins><em><ins class="diff-chg">
value
</ins></em>
to
<ins class="diff-new">an
</ins><a class="tref internalDFN" title="object" href="#dfn-object"><ins class="diff-new">
object
</ins></a><ins class="diff-new">
with
an
</ins><code><ins class="diff-new">
@list
</ins></code><ins class="diff-new">
property
whose
value
is
set
to
</ins><em><ins class="diff-new">
value
</ins></em><ins class="diff-new">
(unless
</ins><em><ins class="diff-new">
value
</ins></em><ins class="diff-new">
is
already
in
that
form).
</ins></li><li><ins class="diff-new">
Convert
</ins><em><ins class="diff-new">
value
</ins></em><ins class="diff-new">
to
</ins><a class="tref internalDFN" title="array" href="#dfn-array"><ins class="diff-new">
array
</ins></a><ins class="diff-new">
form
unless
</ins><em><ins class="diff-new">
value
</ins></em><ins class="diff-new">
is
</ins><a class="tref internalDFN" title="null" href="#dfn-null"><ins class="diff-new">
null
</ins></a><ins class="diff-new">
or
</ins><em><ins class="diff-new">
property
</ins></em><ins class="diff-new">
is
</ins><code><ins class="diff-new">
@id
</ins></code>,<code><ins class="diff-new">
@type
</ins></code>,<code><ins class="diff-new">
@value
</ins></code>,<ins class="diff-new">
or
</ins><code><ins class="diff-new">
@language
</ins></code>.</li><li><ins class="diff-new">
If
</ins><em><ins class="diff-new">
value
</ins></em><ins class="diff-new">
is
not
</ins><a class="tref internalDFN" title="null" href="#dfn-null"><ins class="diff-new">
null
</ins></a>,<ins class="diff-new">
either
merge
</ins><em><ins class="diff-new">
value
</ins></em><ins class="diff-new">
into
an
existing
</ins><em><ins class="diff-new">
property
</ins></em><ins class="diff-new">
property
of
</ins><em><ins class="diff-new">
element
</ins></em><ins class="diff-new">
or
create
a
new
</ins><em><ins class="diff-new">
property
</ins></em><ins class="diff-new">
property
with
</ins><em><ins class="diff-new">
value
</ins></em><ins class="diff-new">
as
value.
</ins></li></ol></li><li><ins class="diff-new">
If
</ins>
the
<del class="diff-old">Value
Expansion
</del>
<ins class="diff-chg">processed
</ins><em><ins class="diff-chg">
element
</ins></em><ins class="diff-chg">
has
an
</ins><code><ins class="diff-chg">
@value
</ins></code><ins class="diff-chg">
property
</ins><ol class="algorithm"><li><em><ins class="diff-chg">
element
</ins></em><em class="rfc2119" title="must not"><ins class="diff-chg">
must
not
</ins></em><ins class="diff-chg">
have
more
than
one
other
property,
which
can
either
be
</ins><code><ins class="diff-chg">
@language
</ins></code><ins class="diff-chg">
or
</ins><code><ins class="diff-chg">
@type
</ins></code><ins class="diff-chg">
with
a
</ins><a class="tref internalDFN" title="string" href="#dfn-string"><ins class="diff-chg">
string
</ins>
</a>
<del class="diff-old">rules,
passing
active
</del>
<ins class="diff-chg">value.
</ins></li><li><ins class="diff-chg">
if
</ins><code><ins class="diff-chg">
@value
</ins></code><ins class="diff-chg">
is
the
only
</ins>
property
<del class="diff-old">.
</del>
<ins class="diff-chg">or
the
value
of
</ins><code><ins class="diff-chg">
@value
</ins></code><ins class="diff-chg">
equals
</ins><a class="tref internalDFN" title="null" href="#dfn-null"><ins class="diff-chg">
null
</ins></a>,<ins class="diff-chg">
replace
</ins><em><ins class="diff-chg">
element
</ins></em><ins class="diff-chg">
with
the
value
of
</ins><code><ins class="diff-chg">
@value
</ins></code>.
</li>
</ol>
</li>
<li>
<del class="diff-old">Remove
</del>
<ins class="diff-chg">Otherwise,
if
</ins><em><ins class="diff-chg">
element
</ins></em><ins class="diff-chg">
has
an
</ins><code><ins class="diff-chg">
@type
</ins></code><ins class="diff-chg">
property
and
it's
value
is
not
in
</ins>
the
<del class="diff-old">context
from
</del>
<ins class="diff-chg">form
of
an
</ins><a class="tref internalDFN" title="array" href="#dfn-array"><ins class="diff-chg">
array
</ins></a>,<ins class="diff-chg">
convert
it
to
an
</ins><a class="tref internalDFN" title="array" href="#dfn-array"><ins class="diff-chg">
array
</ins></a>.</li><li><ins class="diff-chg">
If
</ins><em><ins class="diff-chg">
element
</ins></em><ins class="diff-chg">
has
an
</ins><code><ins class="diff-chg">
@set
</ins></code><ins class="diff-chg">
or
</ins><code><ins class="diff-chg">
@list
</ins></code><ins class="diff-chg">
property,
it
</ins><em class="rfc2119" title="must"><ins class="diff-chg">
must
</ins></em><ins class="diff-chg">
be
</ins>
the
<del class="diff-old">object.
</del>
<ins class="diff-chg">only
property.
Set
</ins><em><ins class="diff-chg">
element
</ins></em><ins class="diff-chg">
to
the
value
of
</ins><code><ins class="diff-chg">
@set
</ins></code><ins class="diff-chg">
;
leave
</ins><code><ins class="diff-chg">
@list
</ins></code><ins class="diff-chg">
untouched.
</ins></li><li><ins class="diff-chg">
If
</ins><em><ins class="diff-chg">
element
</ins></em><ins class="diff-chg">
has
just
a
</ins><code><ins class="diff-chg">
@language
</ins></code><ins class="diff-chg">
property,
set
</ins><em><ins class="diff-chg">
element
</ins></em><ins class="diff-chg">
to
</ins><a class="tref internalDFN" title="null" href="#dfn-null"><ins class="diff-chg">
null
</ins></a>.
</li>
</ol>
</li>
<li>
Otherwise,
expand
<em>
<del class="diff-old">value
</del>
<ins class="diff-chg">element
</ins>
</em>
according
to
the
<a href="#value-expansion">
Value
Expansion
</a>
rules,
passing
<ins class="diff-new">copies
of
the
</ins><a class="tref internalDFN" title="active_context" href="#dfn-active_context"><ins class="diff-new">
active
context
</ins></a><ins class="diff-new">
and
</ins>
<a class="tref internalDFN" title="active_property" href="#dfn-active_property">
active
property
</a>.
</li>
</ol>
<p>
<ins class="diff-new">If,
after
the
algorithm
outlined
above
is
run,
the
resulting
</ins><em><ins class="diff-new">
element
</ins></em><ins class="diff-new">
is
an
</ins><a class="tref internalDFN" title="json_object" href="#dfn-json_object"><ins class="diff-new">
JSON
object
</ins></a><ins class="diff-new">
with
just
a
</ins><code><ins class="diff-new">
@graph
</ins></code><ins class="diff-new">
property,
</ins><em><ins class="diff-new">
element
</ins></em><ins class="diff-new">
is
set
to
the
value
of
</ins><code><ins class="diff-new">
@graph
</ins></code><ins class="diff-new">
's
value.
Finally,
if
</ins><em><ins class="diff-new">
element
</ins></em><ins class="diff-new">
is
a
</ins><a class="tref internalDFN" title="json_object" href="#dfn-json_object"><ins class="diff-new">
JSON
object
</ins></a>,<ins class="diff-new">
it
is
wrapped
into
an
</ins><a class="tref internalDFN" title="array" href="#dfn-array"><ins class="diff-new">
array
</ins></a>.</p>
</div>
</div>
<div id="compaction" class="section">
<h3>
<span class="secno">
<del class="diff-old">3.9
</del>
<ins class="diff-chg">3.10
</ins>
</span>
Compaction
</h3>
<p>
Compaction
is
the
process
of
taking
a
JSON-LD
document
and
applying
a
context
such
that
the
most
compact
form
of
the
document
is
generated.
JSON
is
typically
expressed
in
a
very
compact,
key-value
format.
That
is,
full
IRIs
are
rarely
used
as
keys.
At
times,
a
JSON-LD
document
may
be
received
that
is
not
in
its
most
compact
form.
JSON-LD,
via
the
API,
provides
a
way
to
compact
a
JSON-LD
document.
</p>
<p>
For
example,
assume
the
following
JSON-LD
input
document:
</p>
<pre class="example">{
  &quot;http://xmlns.com/foaf/0.1/name&quot;: &quot;Manu Sporny&quot;,
  &quot;http://xmlns.com/foaf/0.1/homepage&quot;: {
    &quot;@id&quot;: &quot;http://manu.sporny.org/&quot;
  }
}
</pre>
<p>
Additionally,
assume
the
following
developer-supplied
JSON-LD
context:
</p>
<pre class="example">{
<del class="diff-old">  &quot;name&quot;: &quot;http://xmlns.com/foaf/0.1/name&quot;,
  &quot;homepage&quot;: {
    &quot;@id&quot;: &quot;http://xmlns.com/foaf/0.1/homepage&quot;,
    &quot;@type&quot;: &quot;@id&quot;
</del>
<ins class="diff-chg">  &quot;@context&quot;: {
    &quot;name&quot;: &quot;http://xmlns.com/foaf/0.1/name&quot;,
    &quot;homepage&quot;: {
      &quot;@id&quot;: &quot;http://xmlns.com/foaf/0.1/homepage&quot;,
      &quot;@type&quot;: &quot;@id&quot;
    }
</ins>
  }
}
</pre>
<p>
Running
the
JSON-LD
Compaction
algorithm
given
the
context
supplied
above
against
the
JSON-LD
input
document
provided
above
would
result
in
the
following
output:
</p>
<pre class="example">{
  &quot;@context&quot;: {
    &quot;name&quot;: &quot;http://xmlns.com/foaf/0.1/name&quot;,
    &quot;homepage&quot;: {
      &quot;@id&quot;: &quot;http://xmlns.com/foaf/0.1/homepage&quot;,
      &quot;@type&quot;: &quot;@id&quot;
    }
  },
  &quot;name&quot;: &quot;Manu Sporny&quot;,
  &quot;homepage&quot;: &quot;http://manu.sporny.org/&quot;
}
</pre>
<p>
The
compaction
algorithm
also
enables
the
developer
to
map
any
expanded
format
into
an
application-specific
compacted
format.
While
the
context
provided
above
mapped
<code>
http://xmlns.com/foaf/0.1/name
</code>
to
<strong>
name
</strong>,
it
could
have
also
mapped
it
to
any
arbitrary
string
provided
by
the
developer.
</p>
<div id="compaction-algorithm" class="section">
<h4>
<span class="secno">
<del class="diff-old">3.9.1
</del>
<ins class="diff-chg">3.10.1
</ins>
</span>
Compaction
Algorithm
</h4>
<p>
The
algorithm
takes
<del class="diff-old">two
</del>
<ins class="diff-chg">three
</ins>
input
variables:
an
<a class="tref internalDFN" title="active_context" href="#dfn-active_context">
<ins class="diff-new">active
context
</ins></a>,<ins class="diff-new">
an
</ins>
<a class="tref internalDFN" title="active_property" href="#dfn-active_property">
active
property
</a>,
and
<del class="diff-old">a
</del>
<ins class="diff-chg">an
</ins>
<em>
<del class="diff-old">value
</del>
<ins class="diff-chg">element
</ins>
</em>
to
be
<del class="diff-old">expanded.
</del>
<ins class="diff-chg">compacted.
</ins>
To
begin,
the
<a class="tref internalDFN" title="active_context" href="#dfn-active_context">
<ins class="diff-new">active
context
</ins></a><ins class="diff-new">
is
set
to
the
result
of
performing
</ins><a href="#context-processing"><ins class="diff-new">
Context
Processing
</ins></a><ins class="diff-new">
on
the
passed
</ins><em><ins class="diff-new">
context
</ins></em>,
<a class="tref internalDFN" title="active_property" href="#dfn-active_property">
active
property
</a>
is
set
to
<del class="diff-old">nil,
</del>
<a class="tref internalDFN" title="null" href="#dfn-null">
<ins class="diff-chg">null
</ins></a>,
and
<em>
<del class="diff-old">value
</del>
<ins class="diff-chg">element
</ins>
</em>
is
set
to
the
result
of
performing
the
<a href="#expansion-algorithm">
Expansion
Algorithm
</a>
on
the
<a class="tref internalDFN" title="json-ld_input" href="#dfn-json-ld_input">
JSON-LD
input
</a>.
This
removes
any
existing
context
to
allow
the
given
<del class="diff-old">context
to
be
cleanly
applied.
The
</del>
<a class="tref internalDFN" title="active_context" href="#dfn-active_context">
active
context
</a>
to
<del class="diff-old">the
given
context.
</del>
<ins class="diff-chg">be
cleanly
applied.
</ins>
</p>
<ol class="algorithm">
<li>
If
<em>
<del class="diff-old">value
</del>
<ins class="diff-chg">element
</ins>
</em>
is
an
<a class="tref internalDFN" title="array" href="#dfn-array">
array
</a>,
process
each
<del class="diff-old">item
</del>
<ins class="diff-chg">entry
</ins>
in
<em>
<del class="diff-old">value
</del>
<ins class="diff-chg">element
</ins>
</em>
recursively
using
this
algorithm,
passing
a
copy
of
the
<a class="tref internalDFN" title="active_context" href="#dfn-active_context">
<ins class="diff-new">active
context
</ins></a><ins class="diff-new">
and
the
</ins>
<a class="tref internalDFN" title="active_property" href="#dfn-active_property">
active
property
</a>.
<ins class="diff-new">If
</ins><em><ins class="diff-new">
element
</ins></em><ins class="diff-new">
has
a
single
item,
the
compacted
value
is
that
item;
otherwise
the
compacted
value
is
</ins><em><ins class="diff-new">
element
</ins></em>.
</li>
<li>
Otherwise,
if
<em>
<del class="diff-old">value
</del>
<ins class="diff-chg">element
</ins>
</em>
is
an
<del class="diff-old">object,
</del>
<ins class="diff-chg">object:
</ins><ol class="algorithm"><li><ins class="diff-chg">
If
</ins><em><ins class="diff-chg">
element
</ins></em><ins class="diff-chg">
has
an
</ins><code><ins class="diff-chg">
@value
</ins></code><ins class="diff-chg">
property
or
element
is
a
</ins><a class="tref internalDFN" title="subject_reference" href="#dfn-subject_reference"><ins class="diff-chg">
subject
reference
</ins></a>,<ins class="diff-chg">
return
the
result
of
performing
</ins><a href="#value-compaction"><ins class="diff-chg">
Value
Compaction
</ins></a><ins class="diff-chg">
on
</ins><em><ins class="diff-chg">
element
</ins></em><ins class="diff-chg">
using
</ins><a class="tref internalDFN" title="active_property" href="#dfn-active_property"><ins class="diff-chg">
active
property
</ins></a>.</li><li><ins class="diff-chg">
Otherwise,
if
the
</ins><a class="tref internalDFN" title="active_property" href="#dfn-active_property"><ins class="diff-chg">
active
property
</ins></a><ins class="diff-chg">
has
a
</ins><code><ins class="diff-chg">
@container
</ins></code><ins class="diff-chg">
mapping
to
</ins><code><ins class="diff-chg">
@list
</ins></code><ins class="diff-chg">
and
</ins><em><ins class="diff-chg">
element
</ins></em><ins class="diff-chg">
has
a
corresponding
</ins><code><ins class="diff-chg">
@list
</ins></code><ins class="diff-chg">
property,
recursively
compact
that
property's
value
passing
a
copy
of
the
</ins><a class="tref internalDFN" title="active_context" href="#dfn-active_context"><ins class="diff-chg">
active
context
</ins></a><ins class="diff-chg">
and
the
</ins><a class="tref internalDFN" title="active_property" href="#dfn-active_property"><ins class="diff-chg">
active
property
</ins></a><ins class="diff-chg">
ensuring
that
the
result
is
an
array
and
removing
</ins><a class="tref internalDFN" title="null" href="#dfn-null"><ins class="diff-chg">
null
</ins></a><ins class="diff-chg">
values.
Return
either
the
result
as
an
array,
as
an
object
with
a
key
of
</ins><code><ins class="diff-chg">
@list
</ins></code><ins class="diff-chg">
(or
appropriate
alias
from
</ins><a class="tref internalDFN" title="active_context" href="#dfn-active_context"><ins class="diff-chg">
active
context
</ins></a><ins class="diff-chg">
).
</ins></li><li><ins class="diff-chg">
Otherwise,
construct
</ins><em><ins class="diff-chg">
output
</ins></em><ins class="diff-chg">
as
a
new
</ins><a class="tref internalDFN" title="json_object" href="#dfn-json_object"><ins class="diff-chg">
JSON
object
</ins></a><ins class="diff-chg">
used
</ins>
for
<ins class="diff-new">returning
the
result
of
compacting
</ins><em><ins class="diff-new">
element
</ins></em>.<ins class="diff-new">
For
</ins>
each
<del class="diff-old">key
</del>
<em>
<ins class="diff-chg">property
</ins></em>
and
<em>
value
</em>
in
<em>
<del class="diff-old">value
</del>
<ins class="diff-chg">element:
</ins>
</em>
<ol class="algorithm">
<li>
If
<del class="diff-old">the
key
</del>
<em>
<ins class="diff-chg">property
</ins></em>
is
<code>
@id
</code>
or
<code>
@type
</code>
<ol class="algorithm">
<li>
<del class="diff-old">If
</del>
<ins class="diff-chg">Set
</ins><a class="tref internalDFN" title="active_property" href="#dfn-active_property"><ins class="diff-chg">
active
property
</ins></a><ins class="diff-chg">
to
</ins>
the
<del class="diff-old">value
</del>
<ins class="diff-chg">result
</ins>
of
<del class="diff-old">the
key
</del>
<ins class="diff-chg">performing
</ins><a href="#iri-compaction"><abbr title="Internationalized Resource Identifier"><ins class="diff-chg">
IRI
</ins></abbr><ins class="diff-chg">
Compaction
</ins></a><ins class="diff-chg">
on
</ins><em><ins class="diff-chg">
property
</ins></em>.</li><li><ins class="diff-chg">
If
</ins><em><ins class="diff-chg">
value
</ins></em>
is
a
<a class="tref internalDFN" title="string" href="#dfn-string">
string
</a>,
the
compacted
<em>
value
</em>
is
the
result
of
performing
<a href="#iri-compaction">
<abbr title="Internationalized Resource Identifier">
IRI
</abbr>
Compaction
</a>
on
<del class="diff-old">the
value.
</del>
<em>
<ins class="diff-chg">value
</ins></em>.
</li>
<li>
Otherwise,
<del class="diff-old">the
compacted
</del>
<em>
value
<del class="diff-old">is
the
result
of
performing
this
algorithm
</del>
</em>
<em class="rfc2119" title="must">
<ins class="diff-chg">must
</ins></em><ins class="diff-chg">
be
an
</ins><a class="tref internalDFN" title="array" href="#dfn-array"><ins class="diff-chg">
array
</ins></a>.<ins class="diff-chg">
Perform
</ins><a href="#iri-compaction"><abbr title="Internationalized Resource Identifier"><ins class="diff-chg">
IRI
</ins></abbr><ins class="diff-chg">
Compaction
</ins></a>
on
<del class="diff-old">the
</del>
<ins class="diff-chg">every
entry
of
</ins><em>
value
<del class="diff-old">with
the
current
</del>
</em>.
<ins class="diff-chg">If
</ins><em><ins class="diff-chg">
value
</ins></em><ins class="diff-chg">
contains
just
one
entry,
</ins><em><ins class="diff-chg">
value
</ins></em><ins class="diff-chg">
is
set
to
that
entry.
</ins></li><li><ins class="diff-chg">
Add
</ins>
<a class="tref internalDFN" title="active_property" href="#dfn-active_property">
active
property
<del class="diff-old">.
</del>
</a>
<ins class="diff-chg">and
the
expanded
</ins><em><ins class="diff-chg">
value
</ins></em><ins class="diff-chg">
to
</ins><em><ins class="diff-chg">
output
</ins></em>.
</li>
</ol>
</li>
<li>
<del class="diff-old">Otherwise:
</del>
<ins class="diff-chg">Otherwise,
</ins><em><ins class="diff-chg">
value
</ins></em><em class="rfc2119" title="must"><ins class="diff-chg">
must
</ins></em><ins class="diff-chg">
be
an
</ins><a class="tref internalDFN" title="array" href="#dfn-array"><ins class="diff-chg">
array
</ins></a>.</li>
<li>
If
<del class="diff-old">the
key
</del>
<em>
<ins class="diff-chg">value
</ins></em>
is
<del class="diff-old">not
a
keyword
,
set
as
</del>
<ins class="diff-chg">empty:
</ins><ol class="algorithm"><li><ins class="diff-chg">
Set
</ins>
<a class="tref internalDFN" title="active_property" href="#dfn-active_property">
active
property
</a>
<del class="diff-old">and
compact
according
</del>
to
<ins class="diff-new">the
result
of
performing
</ins>
<a href="#iri-compaction">
<abbr title="Internationalized Resource Identifier">
IRI
</abbr>
Compaction
<del class="diff-old">.
</del>
</a>
<ins class="diff-chg">on
</ins><em><ins class="diff-chg">
property
</ins></em>.
</li>
<li>
<del class="diff-old">If
the
value
is
an
object
If
the
value
contains
only
</del>
<ins class="diff-chg">Create
</ins>
an
<del class="diff-old">@id
key
or
the
</del>
<ins class="diff-chg">entry
in
</ins><em><ins class="diff-chg">
output
</ins></em><ins class="diff-chg">
for
</ins><a class="tref internalDFN" title="active_property" href="#dfn-active_property"><ins class="diff-chg">
active
property
</ins></a><ins class="diff-chg">
and
</ins><em>
value
<del class="diff-old">contains
a
@value
key,
the
compacted
</del>
</em>.
</li>
</ol>
</li>
<li>
<ins class="diff-chg">For
each
</ins><em><ins class="diff-chg">
item
</ins></em><ins class="diff-chg">
in
</ins><em>
value
<del class="diff-old">is
</del>
</em>:
<ol class="algorithm">
<li>
<ins class="diff-chg">Set
</ins><a class="tref internalDFN" title="active_property" href="#dfn-active_property"><ins class="diff-chg">
active
property
</ins></a><ins class="diff-chg">
to
</ins>
the
result
of
performing
<del class="diff-old">Value
</del>
<a href="#iri-compaction">
<abbr title="Internationalized Resource Identifier">
<ins class="diff-chg">IRI
</ins></abbr>
Compaction
</a>
<del class="diff-old">on
</del>
<ins class="diff-chg">for
</ins><em><ins class="diff-chg">
property
</ins></em><ins class="diff-chg">
and
</ins><em><ins class="diff-chg">
item
</ins></em><ins class="diff-chg">
using
</ins>
the
<del class="diff-old">value.
</del>
<a class="tref internalDFN" title="active_context" href="#dfn-active_context">
<ins class="diff-chg">active
context
</ins></a>.
</li>
<li>
<del class="diff-old">Otherwise,
if
the
value
contains
only
</del>
<ins class="diff-chg">Compact
</ins><em><ins class="diff-chg">
item
</ins></em><ins class="diff-chg">
by
recursively
performing
this
algorithm
passing
</ins>
a
<del class="diff-old">@list
key,
</del>
<ins class="diff-chg">copy
of
the
</ins><a class="tref internalDFN" title="active_context" href="#dfn-active_context"><ins class="diff-chg">
active
context
</ins></a>
and
the
<a class="tref internalDFN" title="active_property" href="#dfn-active_property">
active
property
<del class="diff-old">is
subject
to
list
coercion,
the
compacted
value
is
the
result
of
performing
this
algorithm
on
that
value.
</del>
</a>.
</li>
<li>
<del class="diff-old">Otherwise,
</del>
<ins class="diff-chg">If
an
entry
already
exists
in
</ins><em><ins class="diff-chg">
output
</ins></em><ins class="diff-chg">
for
</ins><a class="tref internalDFN" title="active_property" href="#dfn-active_property"><ins class="diff-chg">
active
property
</ins></a>,<ins class="diff-chg">
convert
it
to
an
</ins><a class="tref internalDFN" title="array" href="#dfn-array"><ins class="diff-chg">
array
</ins></a><ins class="diff-chg">
if
necessary,
and
append
</ins>
the
compacted
<em>
value
<del class="diff-old">is
the
result
of
performing
this
algorithm
on
the
value.
</del>
</em>.
</li>
<li>
Otherwise,
if
the
<ins class="diff-new">compacted
</ins><em>
value
</em>
is
<ins class="diff-new">not
</ins>
an
<a class="tref internalDFN" title="array" href="#dfn-array">
array
<del class="diff-old">,
the
compacted
</del>
</a>
<ins class="diff-chg">and
</ins><a class="tref internalDFN" title="active_property" href="#dfn-active_property"><ins class="diff-chg">
active
property
</ins></a><ins class="diff-chg">
has
a
</ins><code><ins class="diff-chg">
@container
</ins></code><ins class="diff-chg">
mapping
to
</ins><code><ins class="diff-chg">
@set
</ins></code>,<ins class="diff-chg">
create
an
entry
in
</ins><em><ins class="diff-chg">
output
</ins></em><ins class="diff-chg">
for
</ins><a class="tref internalDFN" title="active_property" href="#dfn-active_property"><ins class="diff-chg">
active
property
</ins></a><ins class="diff-chg">
and
</ins><em>
value
<del class="diff-old">is
the
result
of
performing
this
algorithm
on
the
value.
</del>
</em>
<ins class="diff-chg">as
an
</ins><a class="tref internalDFN" title="array" href="#dfn-array"><ins class="diff-chg">
array
</ins></a>.
</li>
<li>
Otherwise,
<del class="diff-old">the
</del>
<ins class="diff-chg">create
an
entry
in
</ins><em><ins class="diff-chg">
output
</ins></em><ins class="diff-chg">
for
</ins><a class="tref internalDFN" title="active_property" href="#dfn-active_property"><ins class="diff-chg">
active
property
</ins></a><ins class="diff-chg">
and
</ins><em>
value
<del class="diff-old">is
already
compacted.
</del>
</em>.
</li>
</ol>
</li>
</ol>
</li>
</ol>
</li>
<li>
Otherwise,
<ins class="diff-new">return
</ins><em><ins class="diff-new">
element
</ins></em><ins class="diff-new">
as
</ins>
the
compacted
<del class="diff-old">value
is
the
</del>
<em>
<del class="diff-old">value
</del>
<ins class="diff-chg">element
</ins>
</em>.
<div class="issue">
<ins class="diff-new">Perhaps
this
should
also
call
</ins><a href="#value-compaction"><ins class="diff-new">
Value
Compaction
</ins></a><ins class="diff-new">
on
native
types
and
strings,
which
could
consolodate
potential
transformation
in
one
place.
</ins></div>
</li>
</ol>
<p>
<ins class="diff-new">If,
after
the
algorithm
outlined
above
is
run,
the
resulting
</ins><em><ins class="diff-new">
element
</ins></em><ins class="diff-new">
is
an
</ins><a class="tref internalDFN" title="array" href="#dfn-array"><ins class="diff-new">
array
</ins></a>,<ins class="diff-new">
put
</ins><em><ins class="diff-new">
element
</ins></em><ins class="diff-new">
into
the
</ins><code><ins class="diff-new">
@graph
</ins></code><ins class="diff-new">
property
of
a
new
</ins><a class="tref internalDFN" title="json_object" href="#dfn-json_object"><ins class="diff-new">
JSON
object
</ins></a><ins class="diff-new">
and
then
set
</ins><em><ins class="diff-new">
element
</ins></em><ins class="diff-new">
to
that
</ins><a class="tref internalDFN" title="json_object" href="#dfn-json_object"><ins class="diff-new">
JSON
object
</ins></a>.<ins class="diff-new">
Finally,
add
a
</ins><code><ins class="diff-new">
@context
</ins></code><ins class="diff-new">
property
to
</ins><em><ins class="diff-new">
element
</ins></em><ins class="diff-new">
and
set
it
to
the
initially
passed
</ins><em><ins class="diff-new">
context
</ins></em>.</p>
</div>
</div>
<div id="framing" class="section">
<h3>
<span class="secno">
<del class="diff-old">3.10
</del>
<ins class="diff-chg">3.11
</ins>
</span>
Framing
</h3>
<p>
JSON-LD
Framing
allows
developers
to
query
by
example
and
force
a
specific
tree
layout
to
a
JSON-LD
document.
</p>
<p>
A
JSON-LD
document
is
a
representation
of
a
directed
graph.
A
single
directed
graph
can
have
many
different
serializations,
each
expressing
exactly
the
same
information.
Developers
typically
work
with
trees,
represented
as
<a class="tref internalDFN" title="json_object" href="#dfn-json_object">
JSON
object
</a>
s.
While
mapping
a
graph
to
a
tree
can
be
done,
the
layout
of
the
end
result
must
be
specified
in
advance.
A
<dfn title="frame" id="dfn-frame">
Frame
</dfn>
can
be
used
by
a
developer
on
a
JSON-LD
document
to
specify
a
deterministic
layout
for
a
graph.
</p>
<p>
Framing
is
the
process
of
taking
a
JSON-LD
document,
which
expresses
a
graph
of
information,
and
applying
a
specific
graph
layout
(called
a
<a class="tref internalDFN" title="frame" href="#dfn-frame">
Frame
</a>
).
</p>
<p>
<del class="diff-old">The
JSON-LD
document
below
expresses
a
library,
a
book
and
a
chapter:
{
  &quot;@context&quot;: {
    &quot;Book&quot;:         &quot;http://example.org/vocab#Book&quot;,
    &quot;Chapter&quot;:      &quot;http://example.org/vocab#Chapter&quot;,
    &quot;contains&quot;:     {
      &quot;@id&quot;: &quot;http://example.org/vocab#contains&quot;,
      &quot;@type&quot;: &quot;@id&quot;
    },
    &quot;creator&quot;:      &quot;http://purl.org/dc/terms/creator&quot;,
    &quot;description&quot;:  &quot;http://purl.org/dc/terms/description&quot;,
    &quot;Library&quot;:      &quot;http://example.org/vocab#Library&quot;,
    &quot;title&quot;:        &quot;http://purl.org/dc/terms/title&quot;
  },
  &quot;@id&quot;:
  [{
    &quot;@id&quot;: &quot;http://example.com/library&quot;,
    &quot;@type&quot;: &quot;Library&quot;,
    &quot;contains&quot;: &quot;http://example.org/library/the-republic&quot;
  },
  {
    &quot;@id&quot;: &quot;http://example.org/library/the-republic&quot;,
    &quot;@type&quot;: &quot;Book&quot;,
    &quot;creator&quot;: &quot;Plato&quot;,
    &quot;title&quot;: &quot;The Republic&quot;,
    &quot;contains&quot;: &quot;http://example.org/library/the-republic#introduction&quot;
  },
  {
    &quot;@id&quot;: &quot;http://example.org/library/the-republic#introduction&quot;,
    &quot;@type&quot;: &quot;Chapter&quot;,
    &quot;description&quot;: &quot;An introductory chapter on The Republic.&quot;,
    &quot;title&quot;: &quot;The Introduction&quot;
  }]
}
Developers
typically
like
to
operate
on
items
in
a
hierarchical,
tree-based
fashion.
Ideally,
a
developer
would
want
the
data
above
sorted
into
top-level
libraries,
then
the
books
that
are
contained
in
each
library,
and
then
the
chapters
contained
in
each
book.
To
achieve
that
layout,
the
developer
can
define
the
following
frame
:
{
  &quot;@context&quot;: {
    &quot;Book&quot;:         &quot;http://example.org/vocab#Book&quot;,
    &quot;Chapter&quot;:      &quot;http://example.org/vocab#Chapter&quot;,
    &quot;contains&quot;:     &quot;http://example.org/vocab#contains&quot;,
    &quot;creator&quot;:      &quot;http://purl.org/dc/terms/creator&quot;
    &quot;description&quot;:  &quot;http://purl.org/dc/terms/description&quot;
    &quot;Library&quot;:      &quot;http://example.org/vocab#Library&quot;,
    &quot;title&quot;:        &quot;http://purl.org/dc/terms/title&quot;
  },
  &quot;@type&quot;: &quot;Library&quot;,
  &quot;contains&quot;: {
    &quot;@type&quot;: &quot;Book&quot;,
    &quot;contains&quot;: {
      &quot;@type&quot;: &quot;Chapter&quot;
    }
  }
}
When
</del>
<ins class="diff-chg">Framing
makes
use
of
</ins>
the
<del class="diff-old">framing
</del>
<a href="#subject-flattening">
<ins class="diff-chg">Subject
Flattening
</ins></a>
algorithm
<del class="diff-old">is
run
against
the
previously
</del>
<ins class="diff-chg">to
place
each
object
</ins>
defined
<del class="diff-old">JSON-LD
document,
paired
with
the
frame
above,
</del>
<ins class="diff-chg">in
</ins>
the
<del class="diff-old">following
</del>
JSON-LD
document
<del class="diff-old">is
</del>
<ins class="diff-chg">into
a
flat
list
of
objects,
allowing
them
to
be
operated
upon
by
</ins>
the
<del class="diff-old">end
result:
</del>
<ins class="diff-chg">framing
algorithm.
</ins>
</p>
<del class="diff-old">{
  &quot;@context&quot;: {
    &quot;Book&quot;:         &quot;http://example.org/vocab#Book&quot;,
    &quot;Chapter&quot;:      &quot;http://example.org/vocab#Chapter&quot;,
    &quot;contains&quot;:     &quot;http://example.org/vocab#contains&quot;,
    &quot;creator&quot;:      &quot;http://purl.org/dc/terms/creator&quot;
    &quot;description&quot;:  &quot;http://purl.org/dc/terms/description&quot;
    &quot;Library&quot;:      &quot;http://example.org/vocab#Library&quot;,
    &quot;title&quot;:        &quot;http://purl.org/dc/terms/title&quot;
  },
  &quot;@id&quot;: &quot;http://example.org/library&quot;,
  &quot;@type&quot;: &quot;Library&quot;,
  &quot;contains&quot;: {

    &quot;@type&quot;: &quot;Book&quot;,


    &quot;contains&quot;: {

      &quot;@type&quot;: &quot;Chapter&quot;,


    },
  },
}
</del>
<div id="framing-algorithm-terms" class="section">
<h4>
<span class="secno">
<del class="diff-old">3.10.1
</del>
<ins class="diff-chg">3.11.1
</ins>
</span>
Framing
Algorithm
Terms
</h4>
<del class="diff-old">This
algorithm
is
a
work
in
progress,
do
not
implement
it.
There
was
also
a
recent
update
to
the
algorithm
in
order
to
auto-embed
frame-unspecified
data
(if
the
explicit
inclusion
flag
is
not
set)
in
order
to
preserve
graph
information.
This
change
is
particularly
important
for
comparing
subgraphs
(or
verifying
digital
signatures
on
subgraphs).
This
change
is
not
yet
reflected
in
the
algorithm
below.
</del>
<dl>
<dt>
<dfn title="input_frame" id="dfn-input_frame">
input
frame
</dfn>
</dt>
<dd>
the
initial
<a class="tref internalDFN" title="frame" href="#dfn-frame">
frame
</a>
provided
to
the
framing
algorithm.
</dd>
<dt>
<dfn title="framing_context" id="dfn-framing_context">
framing
context
</dfn>
</dt>
<dd>
a
context
containing
<ins class="diff-new">a
</ins><a class="tref internalDFN" title="map_of_embeds" href="#dfn-map_of_embeds"><ins class="diff-new">
map
of
embeds
</ins></a>,
the
<a class="tref internalDFN" title="object_embed_flag" href="#dfn-object_embed_flag">
object
embed
flag
</a>,
the
<a class="tref internalDFN" title="explicit_inclusion_flag" href="#dfn-explicit_inclusion_flag">
explicit
inclusion
flag
</a>
and
the
<a class="tref internalDFN" title="omit_default_flag" href="#dfn-omit_default_flag">
omit
default
flag
</a>.
</dd>
<dt>
<dfn title="map_of_embeds" id="dfn-map_of_embeds">
<ins class="diff-new">map
of
embeds
</ins></dfn></dt><dd><ins class="diff-new">
a
map
that
tracks
if
a
subject
is
to
be
embedded
in
the
output
of
the
</ins><a href="#framing-algorithm"><ins class="diff-new">
Framing
Algorithm
</ins></a><ins class="diff-new">
;
it
maps
a
subject
</ins><code><ins class="diff-new">
@id
</ins></code><ins class="diff-new">
to
a
parent
</ins><a class="tref internalDFN" title="json_object" href="#dfn-json_object"><ins class="diff-new">
JSON
object
</ins></a><ins class="diff-new">
and
property
or
parent
array.
</ins></dd><dt>
<dfn title="object_embed_flag" id="dfn-object_embed_flag">
object
embed
flag
</dfn>
</dt>
<dd>
a
flag
specifying
that
objects
should
be
directly
embedded
in
the
output,
instead
of
being
referred
to
by
their
<abbr title="Internationalized Resource Identifier">
IRI
</abbr>.
</dd>
<dt>
<dfn title="explicit_inclusion_flag" id="dfn-explicit_inclusion_flag">
explicit
inclusion
flag
</dfn>
</dt>
<dd>
a
flag
specifying
that
for
properties
to
be
included
in
the
output,
they
must
be
explicitly
declared
in
the
<a class="tref internalDFN" title="framing_context" href="#dfn-framing_context">
framing
context
</a>.
</dd>
<dt>
<dfn title="omit_default_flag" id="dfn-omit_default_flag">
omit
<del class="diff-old">missing
properties
</del>
<ins class="diff-chg">default
</ins>
flag
</dfn>
</dt>
<dd>
a
flag
specifying
that
properties
that
are
missing
from
the
<a class="tref internalDFN" title="json-ld_input" href="#dfn-json-ld_input">
JSON-LD
input
</a>,
<ins class="diff-new">but
present
in
the
</ins><a class="tref internalDFN" title="input_frame" href="#dfn-input_frame"><ins class="diff-new">
input
frame
</ins>
</a>
should
be
omitted
from
the
output.
</dd>
<dt>
<del class="diff-old">omit
default
flag
Referenced
from
framing
context
,
but
not
defined
match
limit
A
value
specifying
the
maximum
number
of
matches
to
accept
when
building
arrays
of
values
during
the
framing
algorithm.
A
value
of
-1
specifies
that
there
is
no
match
limit.
</del>
<dfn title="map_of_flattened_subjects" id="dfn-map_of_flattened_subjects">
map
of
<del class="diff-old">embedded
</del>
<ins class="diff-chg">flattened
</ins>
subjects
</dfn>
</dt>
<dd>
<del class="diff-old">A
</del>
<ins class="diff-chg">a
</ins>
map
<ins class="diff-new">of
subjects
</ins>
that
<del class="diff-old">tracks
if
a
subject
has
been
embedded
in
</del>
<ins class="diff-chg">is
</ins>
the
<del class="diff-old">output
</del>
<ins class="diff-chg">result
</ins>
of
the
<del class="diff-old">Framing
</del>
<a href="#subject-flattening">
<ins class="diff-chg">Subject
Flattening
</ins>
Algorithm
</a>.
</dd>
</dl>
</div>
<div id="framing-algorithm" class="section">
<h4>
<span class="secno">
<del class="diff-old">3.10.2
</del>
<ins class="diff-chg">3.11.2
</ins>
</span>
Framing
Algorithm
</h4>
<p class="issue">
<ins class="diff-new">This
algorithm
is
a
work
in
progress.
Presently,
it
only
works
for
documents
without
named
graphs.
</ins></p>
<p>
The
framing
algorithm
takes
<ins class="diff-new">an
</ins>
<a class="tref internalDFN" title="json-ld_input" href="#dfn-json-ld_input">
JSON-LD
input
</a>
<del class="diff-old">that
has
been
normalized
according
to
the
Normalization
Algorithm
</del>
(
<strong>
<del class="diff-old">normalized
</del>
<ins class="diff-chg">expanded
</ins>
input
</strong>
<del class="diff-old">),
</del>
<ins class="diff-chg">)
and
</ins>
an
<a class="tref internalDFN" title="input_frame" href="#dfn-input_frame">
input
frame
</a>
<ins class="diff-new">(
</ins><strong><ins class="diff-new">
expanded
frame
</ins></strong><ins class="diff-new">
)
</ins>
that
<del class="diff-old">has
</del>
<ins class="diff-chg">have
</ins>
been
expanded
according
to
the
<a href="#expansion-algorithm">
Expansion
Algorithm
<del class="diff-old">(
expanded
frame
),
</del>
</a>,
and
a
number
of
options
and
produces
<a class="tref internalDFN" title="json-ld_output" href="#dfn-json-ld_output">
JSON-LD
output
</a>.
<del class="diff-old">The
following
series
of
steps
is
the
recursive
portion
of
the
framing
algorithm:
</del>
</p>
<del class="diff-old">Initialize
the
</del>
<p>
<ins class="diff-chg">Create
</ins>
<a class="tref internalDFN" title="framing_context" href="#dfn-framing_context">
framing
context
</a>
<del class="diff-old">by
setting
</del>
<ins class="diff-chg">using
</ins><a class="tref internalDFN" title="null" href="#dfn-null"><ins class="diff-chg">
null
</ins></a><ins class="diff-chg">
for
the
</ins><a class="tref internalDFN" title="map_of_embeds" href="#dfn-map_of_embeds"><ins class="diff-chg">
map
of
embeds
</ins></a>,
the
<a class="tref internalDFN" title="object_embed_flag" href="#dfn-object_embed_flag">
object
embed
flag
</a>
<ins class="diff-new">set
to
</ins><a class="tref internalDFN" title="true" href="#dfn-true"><ins class="diff-new">
true
</ins>
</a>,
<del class="diff-old">clearing
</del>
the
<a class="tref internalDFN" title="explicit_inclusion_flag" href="#dfn-explicit_inclusion_flag">
explicit
inclusion
flag
</a>
<ins class="diff-new">set
to
</ins><a class="tref internalDFN" title="false" href="#dfn-false"><ins class="diff-new">
false
</ins>
</a>,
and
<del class="diff-old">clearing
</del>
the
<a class="tref internalDFN" title="omit_default_flag" href="#dfn-omit_default_flag">
omit
<del class="diff-old">missing
properties
</del>
<ins class="diff-chg">default
</ins>
flag
<del class="diff-old">.
Override
these
values
based
on
input
options
provided
</del>
</a>
<ins class="diff-chg">set
</ins>
to
<del class="diff-old">the
algorithm
by
the
application.
Generate
a
list
</del>
<a class="tref internalDFN" title="false" href="#dfn-false">
<ins class="diff-chg">false
</ins></a><ins class="diff-chg">
along
with
</ins><a class="tref internalDFN" title="map_of_flattened_subjects" href="#dfn-map_of_flattened_subjects"><ins class="diff-chg">
map
</ins>
of
<del class="diff-old">frames
by
processing
the
expanded
frame
:
If
the
expanded
frame
is
not
an
array
,
set
match
limit
</del>
<ins class="diff-chg">flattened
subjects
</ins>
</a>
<ins class="diff-new">set
</ins>
to
<del class="diff-old">1,
place
the
expanded
frame
into
</del>
the
<del class="diff-old">list
</del>
<ins class="diff-chg">result
</ins>
of
<del class="diff-old">frames
,
and
set
the
JSON-LD
output
</del>
<ins class="diff-chg">performing
</ins><a href="#subject-flattening"><ins class="diff-chg">
Subject
Flattening
</ins>
</a>
<del class="diff-old">to
null
.
If
the
</del>
<ins class="diff-chg">on
</ins>
<strong>
expanded
<del class="diff-old">frame
is
</del>
<ins class="diff-chg">input
</ins></strong>.<ins class="diff-chg">
Also
create
</ins><em><ins class="diff-chg">
results
</ins></em><ins class="diff-chg">
as
</ins>
an
empty
<a class="tref internalDFN" title="array" href="#dfn-array">
array
<del class="diff-old">,
place
an
empty
object
into
the
list
of
frames
,
set
</del>
</a>.
</p>
<p>
<ins class="diff-chg">Invoke
</ins>
the
<del class="diff-old">JSON-LD
output
to
an
array
,
and
set
match
limit
</del>
<ins class="diff-chg">recursive
algorithm
using
</ins><a class="tref internalDFN" title="framing_context" href="#dfn-framing_context"><ins class="diff-chg">
framing
context
</ins>
</a>
<del class="diff-old">to
-1.
If
</del>
<ins class="diff-chg">(
</ins><em><ins class="diff-chg">
state
</ins></em><ins class="diff-chg">
),
</ins>
the
<a class="tref internalDFN" title="map_of_flattened_subjects" href="#dfn-map_of_flattened_subjects">
<ins class="diff-new">map
of
flattened
subjects
</ins></a><ins class="diff-new">
(
</ins><em><ins class="diff-new">
subjects
</ins></em><ins class="diff-new">
),
</ins>
<strong>
expanded
frame
</strong>
<del class="diff-old">is
a
non-empty
array
,
add
each
item
in
the
expanded
</del>
<ins class="diff-chg">(
</ins><em>
frame
<del class="diff-old">into
</del>
</em>
<ins class="diff-chg">),
</ins><em><ins class="diff-chg">
result
</ins></em><ins class="diff-chg">
as
</ins><em><ins class="diff-chg">
parent
</ins></em>,<ins class="diff-chg">
and
</ins><a class="tref internalDFN" title="null" href="#dfn-null"><ins class="diff-chg">
null
</ins></a><ins class="diff-chg">
as
</ins><a class="tref internalDFN" title="active_property" href="#dfn-active_property"><ins class="diff-chg">
active
property
</ins></a>.</p><p><ins class="diff-chg">
The
following
series
of
steps
is
</ins>
the
<del class="diff-old">list
</del>
<ins class="diff-chg">recursive
portion
</ins>
of
<del class="diff-old">frames
,
set
</del>
the
<del class="diff-old">JSON-LD
output
to
an
array
,
and
set
match
limit
to
-1.
</del>
<ins class="diff-chg">framing
algorithm:
</ins></p><ol class="algorithm"><li><ins class="diff-chg">
Validate
</ins><em><ins class="diff-chg">
frame
</ins></em>.
</li>
<li>
Create
a
<del class="diff-old">match
array
for
each
expanded
frame
in
the
list
of
frames
halting
when
either
the
match
limit
is
zero
or
the
end
</del>
<ins class="diff-chg">set
</ins>
of
<ins class="diff-new">matched
subjects
by
filtering
</ins><em><ins class="diff-new">
subjects
</ins></em><ins class="diff-new">
checking
</ins>
the
<del class="diff-old">list
</del>
<a class="tref internalDFN" title="map_of_flattened_subjects" href="#dfn-map_of_flattened_subjects">
<ins class="diff-chg">map
</ins>
of
<del class="diff-old">frames
</del>
<ins class="diff-chg">flattened
subjects
</ins>
</a>
<del class="diff-old">is
reached.
</del>
<ins class="diff-chg">against
</ins><em><ins class="diff-chg">
frame
</ins></em>:<ol class="algorithm"><li>
If
<del class="diff-old">an
expanded
</del>
<em>
frame
<del class="diff-old">is
not
an
object,
the
processor
must
</del>
</em>
<del class="diff-old">throw
</del>
<ins class="diff-chg">has
</ins>
a
<code>
<del class="diff-old">Invalid
Frame
Format
</del>
<ins class="diff-chg">@type
</ins>
</code>
<del class="diff-old">exception.
Add
each
matching
item
from
the
normalized
input
to
the
matches
array
</del>
<ins class="diff-chg">property
containing
one
or
more
</ins><a class="tref internalDFN" title="iri" href="#dfn-iri"><ins class="diff-chg">
IRIs
</ins>
</a>
<del class="diff-old">and
decrement
the
</del>
match
<del class="diff-old">limit
</del>
<ins class="diff-chg">any
</ins><a class="tref internalDFN" title="subject_definition" href="#dfn-subject_definition"><ins class="diff-chg">
subject
definition
</ins>
</a>
<del class="diff-old">by
1
if:
The
expanded
frame
has
an
</del>
<ins class="diff-chg">with
a
</ins>
<code>
<del class="diff-old">rdf:type
</del>
<ins class="diff-chg">@type
</ins>
</code>
<del class="diff-old">that
exists
in
the
item's
list
</del>
<ins class="diff-chg">property
including
any
</ins>
of
<ins class="diff-new">those
</ins><a class="tref internalDFN" title="iri" href="#dfn-iri"><ins class="diff-new">
IRIs
</ins></a>.</li><li><ins class="diff-new">
Otherwise,
if
</ins><em><ins class="diff-new">
frame
</ins></em><ins class="diff-new">
has
a
</ins>
<code>
<del class="diff-old">rdf:type
s.
Note:
the
rdf:type
</del>
<ins class="diff-chg">@type
</ins>
</code>
<del class="diff-old">can
be
an
array
,
but
</del>
<ins class="diff-chg">property
</ins>
only
<del class="diff-old">one
value
needs
to
be
in
common
between
the
item
and
the
expanded
frame
for
</del>
a
<del class="diff-old">match.
The
expanded
frame
does
not
have
an
</del>
<ins class="diff-chg">empty
</ins><a class="tref internalDFN" title="json_object" href="#dfn-json_object"><ins class="diff-chg">
JSON
object
</ins></a>,<ins class="diff-chg">
matches
any
</ins><a class="tref internalDFN" title="subject_definition" href="#dfn-subject_definition"><ins class="diff-chg">
subject
definition
</ins></a><ins class="diff-chg">
with
a
</ins>
<code>
<del class="diff-old">rdf:type
</del>
<ins class="diff-chg">@type
</ins>
</code>
property,
<del class="diff-old">but
every
property
in
</del>
<ins class="diff-chg">regardless
of
</ins>
the
<del class="diff-old">expanded
frame
exists
in
</del>
<ins class="diff-chg">actual
values.
</ins></li><li><ins class="diff-chg">
Otherwise,
match
if
</ins>
the
<del class="diff-old">item.
</del>
<a class="tref internalDFN" title="subject_definition" href="#dfn-subject_definition">
<ins class="diff-chg">subject
definition
</ins></a><ins class="diff-chg">
contains
all
of
the
non-
</ins><a class="tref internalDFN" title="keyword" href="#dfn-keyword"><ins class="diff-chg">
keyword
</ins></a><ins class="diff-chg">
properties
in
</ins><em><ins class="diff-chg">
frame
</ins></em>.
</li>
</ol>
<del class="diff-old">matches
array
not
defined
anywhere.
</del>
</li>
<li>
<del class="diff-old">Process
each
item
</del>
<ins class="diff-chg">Get
values
for
</ins><em><ins class="diff-chg">
embedOn
</ins></em><ins class="diff-chg">
and
</ins><em><ins class="diff-chg">
explicitOn
</ins></em><ins class="diff-chg">
by
looking
</ins>
in
<del class="diff-old">the
match
array
with
its
associated
match
</del>
<em>
frame
<del class="diff-old">:
If
</del>
</em>
<ins class="diff-chg">for
</ins>
the
<del class="diff-old">match
frame
contains
an
</del>
<ins class="diff-chg">keys
</ins>
<code>
@embed
</code>
<del class="diff-old">keyword
,
set
</del>
<ins class="diff-chg">and
</ins><code><ins class="diff-chg">
@explicit
</ins></code><ins class="diff-chg">
using
</ins>
the
<ins class="diff-new">current
values
for
</ins>
<a class="tref internalDFN" title="object_embed_flag" href="#dfn-object_embed_flag">
object
embed
flag
</a>
<del class="diff-old">to
its
value.
If
the
match
frame
contains
an
@explicit
keyword
,
set
the
</del>
<ins class="diff-chg">and
</ins>
<a class="tref internalDFN" title="explicit_inclusion_flag" href="#dfn-explicit_inclusion_flag">
explicit
inclusion
flag
</a>
<del class="diff-old">to
its
value.
Note:
</del>
<ins class="diff-chg">from
</ins><em><ins class="diff-chg">
state
</ins></em>
if
<ins class="diff-new">not
found.
</ins></li><li><ins class="diff-new">
For
each
</ins><em><ins class="diff-new">
id
</ins></em><ins class="diff-new">
and
</ins><em><ins class="diff-new">
subject
</ins></em><ins class="diff-new">
from
</ins>
the
<del class="diff-old">keyword
exists,
but
</del>
<ins class="diff-chg">set
of
matched
subjects,
ordered
by
</ins><em><ins class="diff-chg">
id
</ins></em>:<ol class="algorithm"><li><ins class="diff-chg">
If
</ins>
the
<del class="diff-old">value
</del>
<a class="tref internalDFN" title="active_property" href="#dfn-active_property">
<ins class="diff-chg">active
property
</ins></a>
is
<del class="diff-old">neither
true
or
false
,
</del>
<a class="tref internalDFN" title="null" href="#dfn-null">
<ins class="diff-chg">null
</ins></a>,
set
the
<del class="diff-old">associated
flag
</del>
<a class="tref internalDFN" title="map_of_embeds" href="#dfn-map_of_embeds">
<ins class="diff-chg">map
of
embeds
</ins></a><ins class="diff-chg">
in
</ins><em><ins class="diff-chg">
state
</ins></em>
to
<ins class="diff-new">an
empty
map.
</ins></li><li><ins class="diff-new">
Initialize
</ins><em><ins class="diff-new">
output
</ins></em><ins class="diff-new">
with
</ins>
<code>
<del class="diff-old">true
.
</del>
<ins class="diff-chg">@id
</ins></code><ins class="diff-chg">
and
</ins><em><ins class="diff-chg">
id
</ins></em>.
</li>
<li>
<del class="diff-old">If
the
object
</del>
<ins class="diff-chg">Initialize
</ins><em>
embed
<del class="diff-old">flag
</del>
</em>
<ins class="diff-chg">with
</ins><em><ins class="diff-chg">
parent
</ins></em><ins class="diff-chg">
and
</ins><a class="tref internalDFN" title="active_property" href="#dfn-active_property"><ins class="diff-chg">
active
property
</ins>
</a>
<ins class="diff-new">to
</ins><em><ins class="diff-new">
property
</ins></em>.</li><li><ins class="diff-new">
If
</ins><em><ins class="diff-new">
embedOn
</ins></em>
is
<del class="diff-old">cleared
</del>
<a class="tref internalDFN" title="true" href="#dfn-true">
<ins class="diff-chg">true
</ins></a>,
and
<del class="diff-old">the
item
has
the
@id
property,
replace
the
item
with
</del>
<em>
<ins class="diff-chg">id
</ins></em><ins class="diff-chg">
is
in
</ins><a class="tref internalDFN" title="map_of_embeds" href="#dfn-map_of_embeds"><ins class="diff-chg">
map
of
embeds
</ins></a><ins class="diff-chg">
from
</ins><em><ins class="diff-chg">
state
</ins></em>:<ol class="algorithm"><li><ins class="diff-chg">
Set
</ins><em><ins class="diff-chg">
existing
</ins></em><ins class="diff-chg">
to
</ins>
the
value
of
<del class="diff-old">the
@id
property.
</del>
<em>
<ins class="diff-chg">id
</ins></em><ins class="diff-chg">
in
</ins><a class="tref internalDFN" title="map_of_embeds" href="#dfn-map_of_embeds"><ins class="diff-chg">
map
of
embeds
</ins></a><ins class="diff-chg">
and
set
</ins><em><ins class="diff-chg">
embedOn
</ins></em><ins class="diff-chg">
to
</ins><a class="tref internalDFN" title="false" href="#dfn-false"><ins class="diff-chg">
false
</ins></a>.
</li>
<li>
If
<del class="diff-old">the
</del>
<em>
<ins class="diff-chg">existing
</ins></em><ins class="diff-chg">
has
a
</ins><em><ins class="diff-chg">
parent
</ins></em><ins class="diff-chg">
which
is
an
</ins><a class="tref internalDFN" title="array" href="#dfn-array"><ins class="diff-chg">
array
</ins></a><ins class="diff-chg">
containing
a
</ins><a class="tref internalDFN" title="json_object" href="#dfn-json_object"><ins class="diff-chg">
JSON
</ins>
object
<del class="diff-old">embed
flag
</del>
</a>
<del class="diff-old">is
set
and
the
item
has
the
</del>
<ins class="diff-chg">with
</ins>
<code>
@id
</code>
<del class="diff-old">property,
</del>
<ins class="diff-chg">equal
to
</ins><em><ins class="diff-chg">
id
</ins></em>,<em><ins class="diff-chg">
element
</ins></em><ins class="diff-chg">
has
already
been
embedded
</ins>
and
<del class="diff-old">its
IRI
</del>
<ins class="diff-chg">can
be
overwritten,
so
set
</ins><em><ins class="diff-chg">
embedOn
</ins></em><ins class="diff-chg">
to
</ins><a class="tref internalDFN" title="true" href="#dfn-true"><ins class="diff-chg">
true
</ins></a>.</li><li><ins class="diff-chg">
Otherwise,
</ins><em><ins class="diff-chg">
existing
</ins></em><ins class="diff-chg">
has
a
</ins><em><ins class="diff-chg">
parent
</ins></em><ins class="diff-chg">
which
</ins>
is
<ins class="diff-new">a
</ins><a class="tref internalDFN" title="subject_definition" href="#dfn-subject_definition"><ins class="diff-new">
subject
definition
</ins></a>.<ins class="diff-new">
Set
</ins><em><ins class="diff-new">
embedOn
</ins></em><ins class="diff-new">
to
</ins><a class="tref internalDFN" title="true" href="#dfn-true"><ins class="diff-new">
true
</ins></a><ins class="diff-new">
if
any
of
the
items
</ins>
in
<em>
<ins class="diff-new">parent
</ins></em><em><ins class="diff-new">
property
</ins></em><ins class="diff-new">
is
a
</ins><a class="tref internalDFN" title="subject_definition" href="#dfn-subject_definition"><ins class="diff-new">
subject
definition
</ins></a><ins class="diff-new">
or
</ins><a class="tref internalDFN" title="subject_reference" href="#dfn-subject_reference"><ins class="diff-new">
subject
reference
</ins></a><ins class="diff-new">
for
</ins><em><ins class="diff-new">
id
</ins></em><ins class="diff-new">
because
</ins>
the
<del class="diff-old">map
of
embedded
subjects
</del>
<ins class="diff-chg">embed
can
be
overwritten.
</ins></li><li><ins class="diff-chg">
If
</ins><em><ins class="diff-chg">
embedOn
</ins></em><ins class="diff-chg">
is
</ins><a class="tref internalDFN" title="true" href="#dfn-true"><ins class="diff-chg">
true
</ins>
</a>,
<del class="diff-old">throw
a
Duplicate
Embed
exception.
</del>
<em>
<ins class="diff-chg">existing
</ins></em><ins class="diff-chg">
is
already
embedded
but
can
be
overwritten,
so
</ins><a href="#remove-embed"><ins class="diff-chg">
Remove
Embedded
Definition
</ins></a><ins class="diff-chg">
for
</ins><em><ins class="diff-chg">
id
</ins></em>.</li></ol>
</li>
<li>
If
<del class="diff-old">the
object
</del>
<em>
<ins class="diff-chg">embedOn
</ins></em><ins class="diff-chg">
is
</ins><a class="tref internalDFN" title="false" href="#dfn-false"><ins class="diff-chg">
false
</ins></a>,<ins class="diff-chg">
add
</ins><em><ins class="diff-chg">
output
</ins></em><ins class="diff-chg">
to
</ins><em><ins class="diff-chg">
parent
</ins></em><ins class="diff-chg">
by
either
appending
to
</ins><em><ins class="diff-chg">
parent
</ins></em><ins class="diff-chg">
if
it
is
an
</ins><a class="tref internalDFN" title="array" href="#dfn-array"><ins class="diff-chg">
array
</ins></a>,<ins class="diff-chg">
or
appending
to
</ins><a class="tref internalDFN" title="active_property" href="#dfn-active_property"><ins class="diff-chg">
active
property
</ins></a><ins class="diff-chg">
in
</ins><em><ins class="diff-chg">
parent
</ins></em><ins class="diff-chg">
otherwise.
</ins></li><li><ins class="diff-chg">
Otherwise:
</ins><ol class="algorithm"><li><ins class="diff-chg">
Add
</ins><em>
embed
<del class="diff-old">flag
</del>
</em>
<ins class="diff-chg">to
</ins><a class="tref internalDFN" title="map_of_embeds" href="#dfn-map_of_embeds"><ins class="diff-chg">
map
of
embeds
</ins>
</a>
<del class="diff-old">is
set
and
the
item
has
the
@id
</del>
<ins class="diff-chg">for
</ins><em><ins class="diff-chg">
id
</ins></em>.</li><li><ins class="diff-chg">
Process
each
</ins><em>
property
</em>
and
<del class="diff-old">its
IRI
is
not
</del>
<em>
<ins class="diff-chg">value
</ins></em>
in
the
<del class="diff-old">map
of
embedded
subjects
:
</del>
<ins class="diff-chg">matched
</ins><em><ins class="diff-chg">
subject
</ins></em>,<ins class="diff-chg">
ordered
by
</ins><em><ins class="diff-chg">
property
</ins></em>:
<ol class="algorithm">
<li>
If
<del class="diff-old">the
explicit
inclusion
flag
</del>
<em>
<ins class="diff-chg">property
</ins></em>
is
<del class="diff-old">set,
then
delete
any
key
from
the
item
that
does
not
exist
in
the
match
frame
</del>
<ins class="diff-chg">a
</ins><a class="tref internalDFN" title="keyword" href="#dfn-keyword"><ins class="diff-chg">
keyword
</ins>
</a>,
<del class="diff-old">except
@id
.
</del>
<ins class="diff-chg">add
</ins><em><ins class="diff-chg">
property
</ins></em><ins class="diff-chg">
and
a
copy
of
</ins><em><ins class="diff-chg">
value
</ins></em><ins class="diff-chg">
to
</ins><em><ins class="diff-chg">
output
</ins></em><ins class="diff-chg">
and
continue
with
the
next
property
from
</ins><em><ins class="diff-chg">
subject
</ins></em>.
</li>
<li>
<del class="diff-old">For
each
key
</del>
<ins class="diff-chg">If
</ins><em><ins class="diff-chg">
property
</ins></em><ins class="diff-chg">
is
not
</ins>
in
<del class="diff-old">the
match
</del>
<em>
frame
</em>:
<ol class="algorithm">
<li>
<ins class="diff-new">If
</ins><em><ins class="diff-new">
explicitOn
</ins></em><ins class="diff-new">
is
</ins><a class="tref internalDFN" title="false" href="#dfn-false"><ins class="diff-new">
false
</ins>
</a>,
<del class="diff-old">except
for
keyword
</del>
<a href="#embed-values">
<ins class="diff-chg">Embed
values
</ins>
</a>
<del class="diff-old">s
</del>
<ins class="diff-chg">from
</ins><em><ins class="diff-chg">
subject
</ins></em><ins class="diff-chg">
in
</ins><em><ins class="diff-chg">
output
</ins></em><ins class="diff-chg">
using
</ins><em><ins class="diff-chg">
subject
</ins></em><ins class="diff-chg">
as
</ins><em><ins class="diff-chg">
element
</ins></em>
and
<del class="diff-old">rdf:type
:
</del>
<em>
<ins class="diff-chg">property
</ins></em><ins class="diff-chg">
as
</ins><em><ins class="diff-chg">
active
property
</ins></em>.</li><li><ins class="diff-chg">
Continue
to
next
property.
</ins></li></ol></li><li id="frm-process-prop-item"><ins class="diff-chg">
Process
each
</ins><em><ins class="diff-chg">
item
</ins></em><ins class="diff-chg">
from
</ins><em><ins class="diff-chg">
value
</ins></em><ins class="diff-chg">
as
follows:
</ins>
<ol class="algorithm">
<li>
If
<del class="diff-old">the
key
</del>
<em>
<ins class="diff-chg">item
</ins></em>
is
<del class="diff-old">in
</del>
<ins class="diff-chg">a
</ins><a class="tref internalDFN" title="json_object" href="#dfn-json_object"><ins class="diff-chg">
JSON
object
</ins></a><ins class="diff-chg">
with
</ins>
the
<del class="diff-old">item,
</del>
<ins class="diff-chg">key
</ins><code><ins class="diff-chg">
@list
</ins></code>,
then
<del class="diff-old">build
</del>
<ins class="diff-chg">create
</ins>
a
<del class="diff-old">new
recursion
input
list
using
the
</del>
<a class="tref internalDFN" title="json_object" href="#dfn-json_object">
<ins class="diff-chg">JSON
</ins>
object
<del class="diff-old">or
objects
associated
</del>
</a>
<ins class="diff-chg">named
</ins><em><ins class="diff-chg">
list
</ins></em>
with
the
<del class="diff-old">key.
If
any
object
contains
an
</del>
<ins class="diff-chg">key
</ins>
<code>
<del class="diff-old">@id
</del>
<ins class="diff-chg">@list
</ins>
</code>
<ins class="diff-new">and
the
</ins>
value
<del class="diff-old">that
exists
</del>
<ins class="diff-chg">of
an
empty
array.
Append
</ins><em><ins class="diff-chg">
list
</ins></em><ins class="diff-chg">
to
</ins><em><ins class="diff-chg">
property
</ins></em>
in
<del class="diff-old">the
normalized
input
,
replace
the
object
</del>
<em>
<ins class="diff-chg">output
</ins></em>.<ins class="diff-chg">
Process
each
</ins><em><ins class="diff-chg">
listitem
</ins></em>
in
the
<del class="diff-old">recursion
input
list
</del>
<code>
<ins class="diff-chg">@list
</ins></code><ins class="diff-chg">
array
as
follows:
</ins><ol class="algorithm"><li><ins class="diff-chg">
If
</ins><em><ins class="diff-chg">
listitem
</ins></em><ins class="diff-chg">
is
a
</ins><a class="tref internalDFN" title="subject_reference" href="#dfn-subject_reference"><ins class="diff-chg">
subject
reference
</ins>
</a>
<del class="diff-old">with
</del>
<ins class="diff-chg">process
</ins><em><ins class="diff-chg">
listitem
</ins></em><ins class="diff-chg">
recursively
using
this
algorithm
passing
</ins>
a
new
<del class="diff-old">object
containing
</del>
<ins class="diff-chg">map
of
</ins><em><ins class="diff-chg">
subjects
</ins></em><ins class="diff-chg">
that
contains
</ins>
the
<code>
@id
</code>
<del class="diff-old">key
where
the
value
is
the
value
</del>
of
<em>
<ins class="diff-new">listitem
</ins></em><ins class="diff-new">
as
</ins>
the
<del class="diff-old">@id
,
</del>
<ins class="diff-chg">key
</ins>
and
<del class="diff-old">all
of
</del>
the
<del class="diff-old">other
key-value
pairs
for
that
subject.
Set
the
recursion
match
frame
to
the
value
associated
with
</del>
<a class="tref internalDFN" title="subject_definition" href="#dfn-subject_definition">
<ins class="diff-chg">subject
definition
</ins></a><ins class="diff-chg">
from
</ins>
the
<del class="diff-old">match
frame
</del>
<ins class="diff-chg">original
</ins><a class="tref internalDFN" title="map_of_flattened_subjects" href="#dfn-map_of_flattened_subjects"><ins class="diff-chg">
map
of
flattened
subjects
</ins>
</a>
<del class="diff-old">'s
key.
Replace
</del>
<ins class="diff-chg">as
</ins>
the
<del class="diff-old">value
associated
with
</del>
<ins class="diff-chg">value.
Pass
</ins>
the
<del class="diff-old">key
by
recursively
calling
this
algorithm
using
recursion
input
list
,
recursion
match
</del>
<ins class="diff-chg">first
value
from
</ins><em>
frame
</em>
<ins class="diff-chg">for
</ins><em><ins class="diff-chg">
property
</ins></em>
as
<del class="diff-old">input.
</del>
<em>
<ins class="diff-chg">frame
</ins></em>,<em><ins class="diff-chg">
list
</ins></em><ins class="diff-chg">
as
</ins><em><ins class="diff-chg">
parent
</ins></em>,<ins class="diff-chg">
and
</ins><code><ins class="diff-chg">
@list
</ins></code><ins class="diff-chg">
as
</ins><a class="tref internalDFN" title="active_property" href="#dfn-active_property"><ins class="diff-chg">
active
property
</ins></a>.
</li>
<li>
<del class="diff-old">If
the
key
is
not
in
the
item,
add
the
key
to
the
item
and
set
the
associated
value
</del>
<ins class="diff-chg">Otherwise,
append
a
copy
of
</ins><em><ins class="diff-chg">
listitem
</ins></em>
to
<del class="diff-old">an
empty
array
if
the
match
frame
key's
value
is
an
array
or
</del>
<code>
<del class="diff-old">null
</del>
<ins class="diff-chg">@list
</ins>
</code>
<del class="diff-old">otherwise.
</del>
<ins class="diff-chg">in
</ins><em><ins class="diff-chg">
list
</ins></em>.</li></ol>
</li>
<li>
If
<del class="diff-old">value
associated
with
the
item's
key
</del>
<em>
<ins class="diff-chg">item
</ins></em>
is
<del class="diff-old">null
,
</del>
<ins class="diff-chg">a
</ins><a class="tref internalDFN" title="subject_reference" href="#dfn-subject_reference"><ins class="diff-chg">
subject
reference
</ins></a>
process
<em>
<ins class="diff-new">item
</ins></em><ins class="diff-new">
recursively
using
this
algorithm
passing
a
new
map
as
</ins><em><ins class="diff-new">
subjects
</ins></em><ins class="diff-new">
that
contains
</ins>
the
<del class="diff-old">omit
missing
properties
flag
:
If
the
value
associated
with
</del>
<code>
<ins class="diff-chg">@id
</ins></code><ins class="diff-chg">
of
</ins><em><ins class="diff-chg">
item
</ins></em><ins class="diff-chg">
as
</ins>
the
key
<del class="diff-old">in
</del>
<ins class="diff-chg">and
</ins>
the
<del class="diff-old">match
frame
</del>
<a class="tref internalDFN" title="subject_definition" href="#dfn-subject_definition">
<ins class="diff-chg">subject
definition
</ins>
</a>
<del class="diff-old">is
an
array,
use
the
first
frame
</del>
from
the
<del class="diff-old">array
</del>
<ins class="diff-chg">original
</ins><a class="tref internalDFN" title="map_of_flattened_subjects" href="#dfn-map_of_flattened_subjects"><ins class="diff-chg">
map
of
flattened
subjects
</ins></a>
as
the
<del class="diff-old">property
frame
,
otherwise
set
</del>
<ins class="diff-chg">value.
Pass
</ins>
the
<ins class="diff-chg">first
value
from
</ins><em><ins class="diff-chg">
frame
</ins></em><ins class="diff-chg">
for
</ins><em>
property
</em>
<ins class="diff-new">as
</ins><em>
frame
</em>,
<em>
<ins class="diff-new">output
</ins></em><ins class="diff-new">
as
</ins><em><ins class="diff-new">
parent
</ins></em>,<ins class="diff-new">
and
</ins><em><ins class="diff-new">
property
</ins></em><ins class="diff-new">
as
</ins><a class="tref internalDFN" title="active_property" href="#dfn-active_property"><ins class="diff-new">
active
property
</ins></a>.<div class="issue"><ins class="diff-new">
Passing
a
</ins><a class="tref internalDFN" title="subject_reference" href="#dfn-subject_reference"><ins class="diff-new">
subject
reference
</ins>
</a>
<ins class="diff-new">doesn't
work
if
this
map
is
used
recursively.
Presently
pass
</ins><a class="tref internalDFN" title="subject_definition" href="#dfn-subject_definition"><ins class="diff-new">
subject
definition
</ins></a><ins class="diff-new">
from
original
</ins><a class="tref internalDFN" title="map_of_flattened_subjects" href="#dfn-map_of_flattened_subjects"><ins class="diff-new">
map
of
flattened
subjects
</ins></a>.</div></li><li><ins class="diff-new">
Otherwise,
append
a
copy
of
</ins><em><ins class="diff-new">
item
</ins></em>
to
<del class="diff-old">an
empty
object.
</del>
<a class="tref internalDFN" title="active_property" href="#dfn-active_property">
<ins class="diff-chg">active
property
</ins></a><ins class="diff-chg">
in
</ins><em><ins class="diff-chg">
output
</ins></em>.</li></ol></li></ol>
</li>
<li>
<del class="diff-old">If
the
</del>
<ins class="diff-chg">Process
each
</ins><em>
property
</em>
<ins class="diff-new">and
</ins><em><ins class="diff-new">
value
</ins></em><ins class="diff-new">
in
</ins><em>
frame
<del class="diff-old">contains
an
@omitDefault
</del>
</em>,
<ins class="diff-chg">where
</ins><em><ins class="diff-chg">
property
</ins></em><ins class="diff-chg">
is
not
a
</ins><em>
keyword
<del class="diff-old">,
set
the
omit
missing
properties
flag
</del>
</em>,
<ins class="diff-chg">ordered
by
</ins><em><ins class="diff-chg">
property
</ins></em>:<ol class="algorithm"><li><ins class="diff-chg">
Set
</ins><em><ins class="diff-chg">
property
frame
</ins></em>
to
<del class="diff-old">its
value.
Note:
if
</del>
the
<del class="diff-old">keyword
</del>
<ins class="diff-chg">first
item
in
</ins><em><ins class="diff-chg">
value
</ins></em><ins class="diff-chg">
or
a
newly
created
</ins><a class="tref internalDFN" title="json_object" href="#dfn-json_object"><ins class="diff-chg">
JSON
object
</ins>
</a>
<del class="diff-old">exists,
but
the
</del>
<ins class="diff-chg">if
</ins><em>
value
</em>
is
<del class="diff-old">neither
</del>
<ins class="diff-chg">empty.
</ins></li><li><ins class="diff-chg">
Skip
to
the
next
property
in
</ins><em><ins class="diff-chg">
frame
</ins></em><ins class="diff-chg">
if
</ins><em><ins class="diff-chg">
property
</ins></em><ins class="diff-chg">
is
in
</ins><em><ins class="diff-chg">
output
</ins></em><ins class="diff-chg">
or
if
</ins><em><ins class="diff-chg">
property
frame
</ins></em><ins class="diff-chg">
contains
</ins>
<code>
<del class="diff-old">true
</del>
<ins class="diff-chg">@omitDefault
</ins>
</code>
<ins class="diff-new">which
is
</ins><a class="tref internalDFN" title="true" href="#dfn-true"><ins class="diff-new">
true
</ins></a>
or
<ins class="diff-new">if
it
does
not
contain
</ins>
<code>
<del class="diff-old">false
,
set
</del>
<ins class="diff-chg">@omitDefault
</ins></code><ins class="diff-chg">
but
</ins>
the
<del class="diff-old">associated
</del>
<ins class="diff-chg">value
of
</ins><a class="tref internalDFN" title="omit_default_flag" href="#dfn-omit_default_flag"><ins class="diff-chg">
omit
default
</ins>
flag
<del class="diff-old">to
</del>
</a>
<a class="tref internalDFN" title="true" href="#dfn-true">
true
<del class="diff-old">.
</del>
</a>.
</li>
<li>
<del class="diff-old">If
</del>
<ins class="diff-chg">Set
</ins>
the
<del class="diff-old">omit
missing
properties
flag
</del>
<ins class="diff-chg">value
of
</ins><em><ins class="diff-chg">
property
</ins></em><ins class="diff-chg">
in
</ins><em><ins class="diff-chg">
output
</ins></em><ins class="diff-chg">
to
a
new
</ins><a class="tref internalDFN" title="json_object" href="#dfn-json_object"><ins class="diff-chg">
JSON
object
</ins>
</a>
<ins class="diff-new">with
a
property
</ins><code><ins class="diff-new">
@preserve
</ins></code><ins class="diff-new">
and
a
value
that
</ins>
is
<del class="diff-old">set,
delete
the
key
in
the
item.
Otherwise,
if
</del>
<ins class="diff-chg">a
copy
of
</ins>
the
<ins class="diff-new">value
of
</ins>
<code>
@default
</code>
<del class="diff-old">keyword
is
set
</del>
in
<del class="diff-old">the
property
</del>
<em>
frame
<del class="diff-old">set
the
item's
value
to
</del>
</em>
<ins class="diff-chg">if
it
exists,
or
</ins>
the
<del class="diff-old">value
of
</del>
<ins class="diff-chg">string
</ins>
<code>
<del class="diff-old">@default
.
</del>
<ins class="diff-chg">@null
</ins></code><ins class="diff-chg">
otherwise.
</ins>
</li>
</ol>
</li>
<li>
<del class="diff-old">If
the
JSON-LD
</del>
<ins class="diff-chg">Add
</ins><em>
output
<del class="diff-old">is
null
set
it
</del>
</em>
to
<del class="diff-old">the
item,
otherwise,
</del>
<em>
<ins class="diff-chg">parent
</ins></em>.<ins class="diff-chg">
If
</ins><em><ins class="diff-chg">
parent
</ins></em><ins class="diff-chg">
is
an
</ins><a class="tref internalDFN" title="array" href="#dfn-array"><ins class="diff-chg">
array
</ins></a>,
append
<del class="diff-old">the
item
to
the
JSON-LD
</del>
<em>
output
<del class="diff-old">.
</del>
</em>,
<ins class="diff-chg">otherwise
append
</ins><em><ins class="diff-chg">
output
</ins></em><ins class="diff-chg">
to
</ins><a class="tref internalDFN" title="active_property" href="#dfn-active_property"><ins class="diff-chg">
active
property
</ins></a><ins class="diff-chg">
in
</ins><em><ins class="diff-chg">
parent
</ins></em>.
</li>
</ol>
</li>
<del class="diff-old">Return
the
JSON-LD
output
.
</del>
</ol>
</li>
</ol>
<p>
<ins class="diff-new">At
the
completion
of
the
recursive
algorithm,
</ins><em><ins class="diff-new">
results
</ins></em><ins class="diff-new">
will
contain
the
top-level
</ins><a class="tref internalDFN" title="subject_definition" href="#dfn-subject_definition"><ins class="diff-new">
subject
definition
</ins></a><ins class="diff-new">
s.
</ins></p><p>
The
<del class="diff-old">final,
non-recursive
step
</del>
<ins class="diff-chg">final
two
steps
</ins>
of
the
framing
algorithm
<del class="diff-old">requires
the
JSON-LD
output
</del>
<ins class="diff-chg">require
</ins><em><ins class="diff-chg">
results
</ins></em>
to
be
compacted
according
to
the
<a href="#compaction-algorithm">
Compaction
Algorithm
</a>
by
using
the
context
provided
in
the
<a class="tref internalDFN" title="input_frame" href="#dfn-input_frame">
input
frame
</a>.
<del class="diff-old">The
resulting
value
is
the
final
output
of
</del>
<ins class="diff-chg">If
</ins>
the
<ins class="diff-new">frame
has
no
context,
</ins>
compaction
<del class="diff-old">algorithm
and
</del>
is
<del class="diff-old">what
should
be
returned
to
</del>
<ins class="diff-chg">performed
with
an
empty
context
(not
a
null
context).
The
compaction
result
</ins><em class="rfc2119" title="must"><ins class="diff-chg">
must
</ins></em><ins class="diff-chg">
use
</ins>
the
<del class="diff-old">application.
What
are
</del>
<code>
<ins class="diff-chg">@graph
</ins></code><ins class="diff-chg">
keyword
at
</ins>
the
<del class="diff-old">implications
for
framing
lists?
3.11
Normalization
This
algorithm
is
a
work
in
progress,
do
not
implement
it.
Normalization
is
</del>
<ins class="diff-chg">top-level,
even
if
</ins>
the
<del class="diff-old">process
of
taking
JSON-LD
input
and
performing
a
deterministic
transformation
on
that
input
that
results
in
a
normalized
and
serialized
JSON-LD
representation.
Normalization
</del>
<ins class="diff-chg">context
</ins>
is
<del class="diff-old">achieved
by
transforming
JSON-LD
input
</del>
<ins class="diff-chg">empty
or
if
there
is
only
one
element
</ins>
to
<del class="diff-old">RDF,
as
described
</del>
<ins class="diff-chg">put
</ins>
in
<del class="diff-old">RDF
Conversion
,
invoking
</del>
the
<del class="diff-old">normalization
procedure
as
described
in
[
RDF-NORMALIZATION
],
returning
</del>
<code>
<ins class="diff-chg">@graph
</ins></code><ins class="diff-chg">
array.
Subsequently,
replace
all
key-value
pairs
where
</ins>
the
<del class="diff-old">serialized
results.
There
an
open
issue
(
ISSUE-53
)
on
</del>
<ins class="diff-chg">key
is
</ins><code><ins class="diff-chg">
@preserve
</ins></code><ins class="diff-chg">
with
</ins>
the
<del class="diff-old">purpose
and
results
of
performing
normalization.
Previous
versions
of
</del>
<ins class="diff-chg">value
from
</ins>
the
<del class="diff-old">specification
generated
JSON-LD
as
</del>
<ins class="diff-chg">key-pair.
If
</ins>
the
<del class="diff-old">result
of
</del>
<ins class="diff-chg">value
from
</ins>
the
<del class="diff-old">normalization
algorithm,
however
normalization
is
a
process
required
across
different
linked
data
serializations.
To
be
useful,
a
graph
requires
an
identical
normalized
representation
that
</del>
<ins class="diff-chg">key-pair
</ins>
is
<del class="diff-old">independent
of
the
data
format
originally
used
for
markup,
or
the
way
in
which
language
features
or
publisher
preferences
create
differences
in
</del>
<code>
<ins class="diff-chg">@null
</ins></code>,<ins class="diff-chg">
replace
</ins>
the
<del class="diff-old">markup
of
identical
graphs.
It
may
be
that
</del>
<ins class="diff-chg">value
with
</ins><a class="tref internalDFN" title="null" href="#dfn-null"><ins class="diff-chg">
null
</ins></a>.<ins class="diff-chg">
If,
after
replacement,
an
array
contains
only
</ins>
the
<del class="diff-old">need
for
either
or
both
of
flattening
algorithm
or
to
retrieve
such
a
cryptographic
signature.
Normalization
is
useful
when
comparing
two
graphs
against
one
another,
when
generating
a
detailed
list
of
differences
between
two
graphs,
and
when
generating
a
cryptographic
digital
signature
for
information
contained
in
a
graph
or
when
generating
a
hash
of
</del>
<ins class="diff-chg">value
</ins><a class="tref internalDFN" title="null" href="#dfn-null"><ins class="diff-chg">
null
</ins></a><ins class="diff-chg">
remove
</ins>
the
<del class="diff-old">information
contained
in
a
graph.
The
example
below
is
</del>
<ins class="diff-chg">value,
leaving
</ins>
an
<del class="diff-old">un-normalized
JSON-LD
document:
{
  &quot;@context&quot;: {
    &quot;name&quot;: &quot;http://xmlns.com/foaf/0.1/name&quot;,
    &quot;homepage&quot;: {
      &quot;@id&quot;: &quot;http://xmlns.com/foaf/0.1/homepage&quot;,
      &quot;@type&quot;: &quot;@id&quot;
    },
    &quot;xsd&quot;: &quot;http://www.w3.org/2001/XMLSchema#&quot;
  },
  &quot;name&quot;: &quot;Manu Sporny&quot;,
  &quot;homepage&quot;: &quot;http://manu.sporny.org/&quot;
}
</del>
<ins class="diff-chg">empty
array.
</ins>
The
<del class="diff-old">example
below
</del>
<ins class="diff-chg">resulting
value
</ins>
is
the
<del class="diff-old">normalized
form
of
the
</del>
<ins class="diff-chg">final
</ins><a class="tref internalDFN" title="json-ld_output" href="#dfn-json-ld_output">
JSON-LD
<del class="diff-old">document
above:
</del>
<ins class="diff-chg">output
</ins></a>.
</p>
<del class="diff-old">Whitespace
is
used
below
to
aid
readability.
</del>
<p class="issue">
The
<del class="diff-old">normalization
</del>
algorithm
<del class="diff-old">for
JSON-LD
removes
all
unnecessary
whitespace
in
the
fully
normalized
form.
Not
clear
that
whitespace
must
be
normalized,
as
the
JSON-LD
representation
can't
be
used
directly
</del>
<ins class="diff-chg">needs
</ins>
to
<del class="diff-old">create
a
signature,
but
would
</del>
be
<del class="diff-old">based
on
</del>
<ins class="diff-chg">updated
to
consider
</ins><code><ins class="diff-chg">
@graph
</ins></code>.<ins class="diff-chg">
For
1.0,
this
might
not
require
anything,
as
</ins>
the
<del class="diff-old">serialized
result
</del>
<ins class="diff-chg">default
implementation
</ins>
of
<del class="diff-old">[
RDF-NORMALIZATION
</del>
<a href="#subject-flattening">
<ins class="diff-chg">Subject
Flattening
</ins>
</a>
<del class="diff-old">].
</del>
<ins class="diff-chg">should
flatten
everything
into
a
single
graph.
</ins>
</p>
<del class="diff-old">[{
  &quot;@id&quot;: &quot;_:c14n0&quot;,
  &quot;http://xmlns.com/foaf/0.1/homepage&quot;: {
    &quot;@id&quot;: &quot;http://manu.sporny.org/&quot;
  },
  &quot;http://xmlns.com/foaf/0.1/name&quot;: &quot;Manu Sporny&quot;
}]
</del>
</div>
<div id="subject-flattening" class="section">
<h4>
<span class="secno">
<ins class="diff-chg">3.11.3
</ins></span><ins class="diff-chg">
Subject
Flattening
</ins></h4>
<p>
<del class="diff-old">Notice
how
all
of
the
term
s
have
been
</del>
<ins class="diff-chg">Subject
Flattening
takes
as
input
an
</ins>
expanded
<ins class="diff-new">JSON-LD
document,
</ins>
and
<del class="diff-old">sorted
</del>
<ins class="diff-chg">results
</ins>
in
<del class="diff-old">alphabetical
order.
Also,
notice
how
the
subject
</del>
<ins class="diff-chg">a
</ins><a class="tref internalDFN" title="json_object" href="#dfn-json_object"><ins class="diff-chg">
JSON
object
</ins>
</a>
<del class="diff-old">has
been
labeled
</del>
<em>
<ins class="diff-chg">subjects
</ins></em>
with
a
<del class="diff-old">named
</del>
<ins class="diff-chg">mapping
from
each
object
represented
in
the
document
to
a
single
entry
within
the
input
document,
assigning
</ins>
<a class="tref internalDFN" title="blank_node" href="#dfn-blank_node">
blank
node
<del class="diff-old">.
Normalization
ensures
that
any
arbitrary
graph
containing
exactly
the
same
information
would
be
normalized
</del>
</a>
<ins class="diff-chg">identifiers
</ins>
to
<del class="diff-old">exactly
the
same
form
shown
above.
</del>
<ins class="diff-chg">objects
without
a
@id,
or
with
an
@id
that
references
a
blank
node
identifier.
</ins>
</p>
<del class="diff-old">3.11.1
Normalization
Algorithm
</del>
<p>
The
<del class="diff-old">normalization
</del>
algorithm
<del class="diff-old">transforms
</del>
<ins class="diff-chg">operates
on
</ins>
the
<del class="diff-old">JSON-LD
input
into
RDF,
normalizes
it
according
to
[
RDF-NORMALIZATION
]
</del>
<ins class="diff-chg">initially
empty
</ins><em><ins class="diff-chg">
subjects
</ins></em>
and
<del class="diff-old">then
transforms
back
to
JSON-LD.
The
result
</del>
<ins class="diff-chg">takes
as
input
the
current
document
</ins><em><ins class="diff-chg">
element
</ins></em>.</p><ol class="algorithm"><li><ins class="diff-chg">
If
</ins><em><ins class="diff-chg">
element
</ins></em>
is
an
<del class="diff-old">object
representation
that
deterministically
represents
</del>
<ins class="diff-chg">array,
process
each
entry
in
element
recursively,
using
this
algorithm.
</ins></li><li><ins class="diff-chg">
Otherwise,
if
element
is
</ins>
a
<del class="diff-old">RDF
graph.
</del>
<ins class="diff-chg">JSON
object:
</ins>
<ol class="algorithm">
<li>
<del class="diff-old">Transform
the
JSON-LD
input
</del>
<ins class="diff-chg">If
element
is
a
</ins><a class="tref internalDFN" title="subject_definition" href="#dfn-subject_definition"><ins class="diff-chg">
subject
definition
</ins>
</a>
<del class="diff-old">to
RDF
according
to
the
steps
in
the
RDF
Conversion
Algorithm
.
</del>
<ins class="diff-chg">or
</ins><a class="tref internalDFN" title="subject_reference" href="#dfn-subject_reference"><ins class="diff-chg">
subject
reference
</ins></a>:<ol class="algorithm">
<li>
<del class="diff-old">Perform
[
</del>
<ins class="diff-chg">If
the
property
</ins><cide><ins class="diff-chg">
@id
</ins></cide><ins class="diff-chg">
is
not
an
</ins><a class="tref internalDFN" title="iri" href="#dfn-iri">
<del class="diff-old">RDF-NORMALIZATION
</del>
<abbr title="Internationalized Resource Identifier">
<ins class="diff-chg">IRI
</ins></abbr>
<del class="diff-old">]
of
that
RDF
to
create
</del>
</a>,
<ins class="diff-chg">return
</ins>
a
<del class="diff-old">serialized
N-Triples
representation
</del>
<a class="tref internalDFN" title="blank_node" href="#dfn-blank_node">
<ins class="diff-chg">blank
node
</ins></a><ins class="diff-chg">
identifer
using
</ins><a href="#generate-blank-node-identifier"><ins class="diff-chg">
Generate
Blank
Node
Identifier
</ins></a><ins class="diff-chg">
as
</ins><em><ins class="diff-chg">
name
</ins></em>,<ins class="diff-chg">
otherwise
use
the
value
</ins>
of
the
<del class="diff-old">RDF
graph.
</del>
<ins class="diff-chg">@id
property
as
</ins><em><ins class="diff-chg">
name
</ins></em>.
</li>
<li>
<del class="diff-old">Construct
</del>
<ins class="diff-chg">Unless
</ins><em><ins class="diff-chg">
subjects
</ins></em><ins class="diff-chg">
as
an
entry
for
</ins><em><ins class="diff-chg">
name
</ins></em><ins class="diff-chg">
create
</ins>
a
<ins class="diff-new">new
entry
in
</ins><em><ins class="diff-new">
subjects
</ins></em><ins class="diff-new">
initialized
using
a
new
</ins><a class="tref internalDFN" title="json_object" href="#dfn-json_object">
JSON
<del class="diff-old">array
</del>
<ins class="diff-chg">object
</ins>
</a>
<ins class="diff-new">with
</ins><code><ins class="diff-new">
@id
</ins></code><ins class="diff-new">
set
to
</ins>
<em>
<del class="diff-old">array
</del>
<ins class="diff-chg">name
</ins>
</em>
<del class="diff-old">to
serve
</del>
as
<del class="diff-old">the
output
object.
</del>
<em>
<ins class="diff-chg">subject
</ins></em>.<ins class="diff-chg">
Otherwise,
use
that
existing
entrpy
as
</ins><em><ins class="diff-chg">
subject
</ins></em>.
</li>
<li>
For
each
<del class="diff-old">triple
in
the
N-Triples
document
having
subject
,
</del>
<em>
<del class="diff-old">predicate
,
</del>
<ins class="diff-chg">property
</ins></em>
and
<em>
<del class="diff-old">object
:
</del>
<ins class="diff-chg">value
</ins></em><ins class="diff-chg">
in
</ins><em><ins class="diff-chg">
element
</ins></em><ins class="diff-chg">
other
than
</ins><code><ins class="diff-chg">
@id
</ins></code>:
<ol class="algorithm">
<li>
If
<em>
<del class="diff-old">predicate
</del>
<ins class="diff-chg">property
</ins>
</em>
is
<ins class="diff-new">a
keyword,
copy
</ins><code><ins class="diff-new">
property
</ins></code><ins class="diff-new">
and
</ins>
<code>
<del class="diff-old">http://www.w3.org/1999/02/22-rdf-syntax-ns#first
,
let
object
representation
be
object
represented
in
expanded
form
as
described
in
Value
Expansion
.
Set
</del>
value
<del class="diff-old">as
the
last
entry
in
array
.
</del>
</code>
<ins class="diff-chg">to
</ins><code><ins class="diff-chg">
subject
</ins></code>.
</li>
<li>
<del class="diff-old">If
the
last
entry
in
</del>
<ins class="diff-chg">Otherwise,
if
</ins>
value
is
<del class="diff-old">subject
,
replace
</del>
<ins class="diff-chg">a
</ins><a class="tref internalDFN" title="json_object" href="#dfn-json_object"><ins class="diff-chg">
JSON
object
</ins></a>,
it
<del class="diff-old">with
</del>
<em class="rfc2119" title="must">
<ins class="diff-chg">must
</ins></em><ins class="diff-chg">
only
have
</ins>
the
<ins class="diff-new">key
</ins><code><ins class="diff-new">
@list.
</ins></code><ins class="diff-new">
Create
</ins>
a
<ins class="diff-new">new
</ins>
<a class="tref internalDFN" title="json_object" href="#dfn-json_object">
JSON
object
</a>
<del class="diff-old">having
a
key/value
pair
of
</del>
<ins class="diff-chg">containing
</ins>
<code>
@list
</code>
and
an
<a class="tref internalDFN" title="array" href="#dfn-array">
array
</a>
<del class="diff-old">containing
</del>
<ins class="diff-chg">created
by
performing
this
algorithm
recursively
on
each
item
in
the
list
and
add
to
</ins>
<em>
<del class="diff-old">object
representation
</del>
<ins class="diff-chg">subject
</ins></em><ins class="diff-chg">
along
with
</ins><em><ins class="diff-chg">
property
</ins>
</em>.
</li>
<li>
Otherwise,
<del class="diff-old">the
last
key/value
entry
in
</del>
value
<em class="rfc2119" title="must">
must
</em>
be
<ins class="diff-new">an
</ins><a class="tref internalDFN" title="array" href="#dfn-array"><ins class="diff-new">
array
</ins></a>.<ins class="diff-new">
Add
property
to
</ins><em><ins class="diff-new">
subject
</ins></em><ins class="diff-new">
and
an
array
value
created
by
performing
this
algorithm
recursively
on
each
item
in
the
array.
</ins></li></ol></li><li><ins class="diff-new">
Return
</ins>
a
<ins class="diff-new">new
</ins>
<a class="tref internalDFN" title="json_object" href="#dfn-json_object">
JSON
object
</a>
<del class="diff-old">having
a
single
key
of
@list
with
</del>
<ins class="diff-chg">created
as
</ins>
a
<del class="diff-old">value
that
is
an
array
.
Append
</del>
<a class="tref internalDFN" title="subject_reference" href="#dfn-subject_reference">
<ins class="diff-chg">subject
reference
</ins></a><ins class="diff-chg">
to
</ins>
<em>
<del class="diff-old">object
representation
</del>
<ins class="diff-chg">name
</ins>
</em>.
</li>
</ol>
</li>
<li>
Otherwise,
<del class="diff-old">if
</del>
<ins class="diff-chg">return
</ins>
<em>
<del class="diff-old">predicate
is
http://www.w3.org/1999/02/22-rdf-syntax-ns#rest
,
ignore
this
triple.
</del>
<ins class="diff-chg">element
</ins></em>.</li></ol>
</li>
<li>
Otherwise,
<del class="diff-old">if
</del>
<ins class="diff-chg">return
</ins><em><ins class="diff-chg">
element
</ins></em>.</li></ol><p class="issue"><ins class="diff-chg">
The
algorithm
states
to
set
</ins>
the
<del class="diff-old">last
entry
</del>
<ins class="diff-chg">property
</ins>
in
<em>
<del class="diff-old">array
</del>
<ins class="diff-chg">subject
</ins>
</em>
<del class="diff-old">is
not
</del>
<ins class="diff-chg">using
the
mapped
values,
but
it
really
should
merge,
if
the
property
already
exists
in
</ins><em><ins class="diff-chg">
subject
</ins></em>.</p><p class="issue"><ins class="diff-chg">
The
algorithm
should
descend
into
@graph
and
create
</ins>
a
<del class="diff-old">JSON
Object
with
</del>
<ins class="diff-chg">parallel
flattened
structure
of
subject
to
object
within
that
</ins><code><ins class="diff-chg">
@graph
</ins></code><ins class="diff-chg">
representation.
Recursive
</ins><code><ins class="diff-chg">
@graph
</ins></code><ins class="diff-chg">
definitions
are
also
flattened
into
the
default
graph.
The
algorithm
should
also
take
</ins>
an
<ins class="diff-new">option
which
descends
into
</ins>
<code>
<del class="diff-old">@id
</del>
<ins class="diff-chg">@graph
</ins>
</code>
<del class="diff-old">having
</del>
<ins class="diff-chg">and
flattens
all
definitions
at
the
same
level,
effectively
flatting
default
and
named
graphs
into
</ins>
a
<del class="diff-old">value
of
</del>
<ins class="diff-chg">single
default
graph;
this
should
be
the
default
implementation
for
1.0.
</ins></p></div><div id="remove-embed" class="section"><h4><span class="secno"><ins class="diff-chg">
3.11.4
</ins></span><ins class="diff-chg">
Remove
Embedded
Definition
</ins></h4><p><ins class="diff-chg">
This
algorithm
replaces
an
already
embedded
</ins><a class="tref internalDFN" title="subject_definition" href="#dfn-subject_definition">
subject
<del class="diff-old">:
Create
a
new
JSON
Object
</del>
<ins class="diff-chg">definition
</ins>
</a>
with
<del class="diff-old">key/value
pair
of
@id
and
</del>
a
<del class="diff-old">string
representation
</del>
<a class="tref internalDFN" title="subject_reference" href="#dfn-subject_reference">
<ins class="diff-chg">subject
reference
</ins></a>.<ins class="diff-chg">
It
then
recursively
removes
any
entries
in
the
</ins><a class="tref internalDFN" title="map_of_embeds" href="#dfn-map_of_embeds"><ins class="diff-chg">
map
</ins>
of
<ins class="diff-chg">embeds
</ins></a><ins class="diff-chg">
that
had
the
removed
</ins><a class="tref internalDFN" title="subject_definition" href="#dfn-subject_definition">
subject
<del class="diff-old">and
use
</del>
<ins class="diff-chg">definition
</ins></a><ins class="diff-chg">
in
their
parent
chain.
</ins></p><div class="issue"><ins class="diff-chg">
About
</ins>
as
<ins class="diff-new">clear
as
mud
</ins></div><p></p><p><ins class="diff-new">
The
algorithm
is
invoked
with
a
</ins><a class="tref internalDFN" title="framing_context" href="#dfn-framing_context"><ins class="diff-new">
framing
context
</ins></a><ins class="diff-new">
and
subject
id
</ins>
<em>
<del class="diff-old">value
</del>
<ins class="diff-chg">id
</ins>
</em>.
</p>
<ol class="algorithm">
<li>
<del class="diff-old">Otherwise,
set
</del>
<ins class="diff-chg">Find
</ins>
<em>
<del class="diff-old">value
</del>
<ins class="diff-chg">embed
</ins>
</em>
<del class="diff-old">to
that
value.
</del>
<ins class="diff-chg">from
</ins><a class="tref internalDFN" title="map_of_embeds" href="#dfn-map_of_embeds"><ins class="diff-chg">
map
of
embeds
</ins></a><ins class="diff-chg">
for
</ins><em><ins class="diff-chg">
id
</ins></em>.
</li>
<li>
<del class="diff-old">If
predicate
is
http://www.w3.org/1999/02/22-rdf-syntax-ns#type
:
</del>
<ins class="diff-chg">Let
</ins><em><ins class="diff-chg">
parent
</ins></em><ins class="diff-chg">
and
</ins><em><ins class="diff-chg">
property
</ins></em><ins class="diff-chg">
be
from
</ins><em><ins class="diff-chg">
embed
</ins></em>.</li>
<li>
If
<em>
<del class="diff-old">value
</del>
<ins class="diff-chg">parent
</ins>
</em>
<del class="diff-old">has
an
key/value
pair
of
@type
and
</del>
<ins class="diff-chg">is
</ins>
an
<del class="diff-old">array
,
append
</del>
<ins class="diff-chg">array,
replace
</ins>
the
<del class="diff-old">string
representation
of
</del>
<a class="tref internalDFN" title="subject_definition" href="#dfn-subject_definition">
<ins class="diff-chg">subject
definition
</ins></a><ins class="diff-chg">
that
matches
</ins><em><ins class="diff-chg">
id
</ins></em><ins class="diff-chg">
with
a
</ins><a class="tref internalDFN" title="subject_reference" href="#dfn-subject_reference"><ins class="diff-chg">
subject
reference
</ins></a>.<ins class="diff-chg">
If
parent
is
a
</ins><a class="tref internalDFN" title="json_object" href="#dfn-json_object"><ins class="diff-chg">
JSON
</ins>
object
</a>,
<ins class="diff-new">replace
the
</ins><a class="tref internalDFN" title="subject_definition" href="#dfn-subject_definition"><ins class="diff-new">
subject
definition
</ins>
</a>
<del class="diff-old">to
</del>
<ins class="diff-chg">for
</ins><em><ins class="diff-chg">
property
</ins></em>
that
<del class="diff-old">array.
</del>
<ins class="diff-chg">matches
</ins><em><ins class="diff-chg">
id
</ins></em><ins class="diff-chg">
with
a
</ins><a class="tref internalDFN" title="subject_reference" href="#dfn-subject_reference"><ins class="diff-chg">
subject
reference
</ins></a>.
</li>
<li>
<del class="diff-old">Otherwise,
if
</del>
<ins class="diff-chg">Remove
dependents
for
</ins>
<em>
<del class="diff-old">value
</del>
<ins class="diff-chg">id
</ins>
</em>
<del class="diff-old">has
an
key
</del>
<ins class="diff-chg">in
</ins><a class="tref internalDFN" title="map_of_embeds" href="#dfn-map_of_embeds"><ins class="diff-chg">
map
</ins>
of
<ins class="diff-new">embeds
</ins></a><ins class="diff-new">
by
scanning
the
map
for
entries
with
</ins><em><ins class="diff-new">
parent
</ins></em><ins class="diff-new">
that
have
an
</ins>
<code>
<del class="diff-old">@type
,
replace
</del>
<ins class="diff-chg">@id
</ins></code><ins class="diff-chg">
of
</ins><em><ins class="diff-chg">
id
</ins></em>,<ins class="diff-chg">
removing
</ins>
that
<del class="diff-old">value
with
a
new
array
containing
</del>
<ins class="diff-chg">definition
from
</ins>
the
<del class="diff-old">existing
value
</del>
<ins class="diff-chg">map,
</ins>
and
<ins class="diff-new">then
removing
the
dependents
for
the
</ins><em><ins class="diff-new">
parent
</ins></em><ins class="diff-new">
id
recursively
by
repeating
this
step.
This
step
will
terminate
when
there
are
no
more
embed
entries
containing
the
removed
</ins><a class="tref internalDFN" title="subject_definition" href="#dfn-subject_definition"><ins class="diff-new">
subject
definition
</ins></a><ins class="diff-new">
's
</ins><code><ins class="diff-new">
@id
</ins></code><ins class="diff-new">
in
their
parent
chain.
</ins></li></ol></div><div id="embed-values" class="section"><h4><span class="secno"><ins class="diff-new">
3.11.5
</ins></span><ins class="diff-new">
Embed
Values
</ins></h4><p><ins class="diff-new">
This
algorithm
recursively
embeds
property
values
in
</ins><a class="tref internalDFN" title="subject_definition" href="#dfn-subject_definition"><ins class="diff-new">
subject
definition
</ins></a><em><ins class="diff-new">
output
</ins></em>,<ins class="diff-new">
given
</ins>
a
<del class="diff-old">string
representation
of
</del>
<a class="tref internalDFN" title="framing_context" href="#dfn-framing_context">
<ins class="diff-chg">framing
context
</ins></a>,<ins class="diff-chg">
input
</ins><a class="tref internalDFN" title="subject_definition" href="#dfn-subject_definition"><ins class="diff-chg">
subject
definition
</ins></a>
<em>
<del class="diff-old">object
</del>
<ins class="diff-chg">element
</ins></em>,<a class="tref internalDFN" title="active_property" href="#dfn-active_property"><ins class="diff-chg">
active
property
</ins></a>,<ins class="diff-chg">
and
</ins><em><ins class="diff-chg">
output
</ins>
</em>.
</p>
<ol class="algorithm">
<li>
<del class="diff-old">Otherwise,
</del>
<ins class="diff-chg">For
each
</ins><em><ins class="diff-chg">
item
</ins></em><ins class="diff-chg">
in
</ins><a class="tref internalDFN" title="active_property" href="#dfn-active_property"><ins class="diff-chg">
active
property
</ins></a><ins class="diff-chg">
of
</ins><em><ins class="diff-chg">
element
</ins></em>:<ol class="algorithm"><li><ins class="diff-chg">
If
</ins><em><ins class="diff-chg">
item
</ins></em><ins class="diff-chg">
is
a
</ins><a class="tref internalDFN" title="json_object" href="#dfn-json_object"><ins class="diff-chg">
JSON
object
</ins></a><ins class="diff-chg">
with
the
key
</ins><code><ins class="diff-chg">
@list
</ins></code>,<ins class="diff-chg">
then
</ins>
create
a
new
<del class="diff-old">entry
in
value
</del>
<a class="tref internalDFN" title="json_object" href="#dfn-json_object">
<ins class="diff-chg">JSON
object
</ins></a>
with
a
key
<del class="diff-old">of
</del>
<code>
<del class="diff-old">@type
</del>
<ins class="diff-chg">@list
</ins>
</code>
and
<del class="diff-old">value
being
</del>
a
<del class="diff-old">string
representation
</del>
<ins class="diff-chg">value
</ins>
of
<ins class="diff-new">an
empty
array
and
add
it
to
</ins>
<em>
<del class="diff-old">object
</del>
<ins class="diff-chg">output
</ins></em>,<ins class="diff-chg">
appending
if
</ins><em><ins class="diff-chg">
output
</ins></em><ins class="diff-chg">
is
an
array,
and
appending
to
</ins><a class="tref internalDFN" title="active_property" href="#dfn-active_property"><ins class="diff-chg">
active
property
</ins></a><ins class="diff-chg">
otherwise.
Recursively
call
this
algorithm
passing
</ins><em><ins class="diff-chg">
item
</ins></em><ins class="diff-chg">
as
</ins><em><ins class="diff-chg">
element
</ins></em>,<code><ins class="diff-chg">
@list
</ins></code><ins class="diff-chg">
as
</ins><a class="tref internalDFN" title="active_property" href="#dfn-active_property"><ins class="diff-chg">
active
property
</ins></a>,<ins class="diff-chg">
and
the
new
array
as
</ins><em><ins class="diff-chg">
output
</ins></em>.<ins class="diff-chg">
Continue
to
the
next
</ins><em><ins class="diff-chg">
item
</ins>
</em>.
</li>
<li>
<del class="diff-old">Otherwise,
let
</del>
<ins class="diff-chg">If
</ins>
<em>
<del class="diff-old">key
</del>
<ins class="diff-chg">item
</ins>
</em>
<del class="diff-old">by
</del>
<ins class="diff-chg">is
a
</ins><a class="tref internalDFN" title="subject_reference" href="#dfn-subject_reference"><ins class="diff-chg">
subject
reference
</ins></a>:<ol class="algorithm"><li><ins class="diff-chg">
If
</ins><a class="tref internalDFN" title="map_of_embeds" href="#dfn-map_of_embeds"><ins class="diff-chg">
map
of
embeds
</ins></a><ins class="diff-chg">
does
not
contain
an
entry
for
</ins>
the
<del class="diff-old">string
representation
</del>
<code>
<ins class="diff-chg">@id
</ins></code>
of
<em>
<del class="diff-old">predicate
</del>
<ins class="diff-chg">item
</ins></em>:<ol class="algorithm"><li><ins class="diff-chg">
Initialize
</ins><em><ins class="diff-chg">
embed
</ins></em><ins class="diff-chg">
with
</ins><em><ins class="diff-chg">
output
</ins></em><ins class="diff-chg">
as
</ins><em><ins class="diff-chg">
parent
</ins>
</em>
and
<del class="diff-old">let
</del>
<a class="tref internalDFN" title="active_property" href="#dfn-active_property">
<ins class="diff-chg">active
property
</ins></a><ins class="diff-chg">
as
</ins>
<em>
<del class="diff-old">object
representation
</del>
<ins class="diff-chg">property
</ins>
</em>
<del class="diff-old">be
</del>
<ins class="diff-chg">and
add
to
</ins><a class="tref internalDFN" title="map_of_embeds" href="#dfn-map_of_embeds"><ins class="diff-chg">
map
of
embeds
</ins></a>.</li><li><ins class="diff-chg">
Initialize
a
new
</ins><a class="tref internalDFN" title="subject_definition" href="#dfn-subject_definition"><ins class="diff-chg">
subject
definition
</ins></a>
<em>
<del class="diff-old">object
</del>
<ins class="diff-chg">o
</ins>
</em>
<del class="diff-old">represented
in
expanded
form
</del>
<ins class="diff-chg">to
act
</ins>
as
<del class="diff-old">described
in
Value
Expansion
</del>
<ins class="diff-chg">the
embedded
</ins><a class="tref internalDFN" title="subject_definition" href="#dfn-subject_definition"><ins class="diff-chg">
subject
definition
</ins>
</a>.
</li>
<li>
<del class="diff-old">If
</del>
<ins class="diff-chg">For
each
</ins><em><ins class="diff-chg">
property
</ins></em><ins class="diff-chg">
and
</ins>
<em>
value
</em>
<del class="diff-old">has
an
key/value
pair
of
</del>
<ins class="diff-chg">in
the
expanded
definition
for
</ins>
<em>
<del class="diff-old">key
</del>
<ins class="diff-chg">item
</ins></em><ins class="diff-chg">
in
</ins><em><ins class="diff-chg">
subjects
</ins></em>:<ol class="algorithm"><li><ins class="diff-chg">
Add
</ins><em><ins class="diff-chg">
property
</ins>
</em>
and
<del class="diff-old">an
array
,
append
</del>
<ins class="diff-chg">a
copy
of
</ins>
<em>
<del class="diff-old">object
representation
</del>
<ins class="diff-chg">value
</ins>
</em>
to
<del class="diff-old">that
array.
</del>
<em>
<ins class="diff-chg">o
</ins></em><ins class="diff-chg">
if
</ins><em><ins class="diff-chg">
property
</ins></em><ins class="diff-chg">
is
a
</ins><a class="tref internalDFN" title="keyword" href="#dfn-keyword"><ins class="diff-chg">
keyword
</ins></a>.
</li>
<li>
Otherwise,
<del class="diff-old">if
</del>
<ins class="diff-chg">recursively
call
this
algorithm
passing
</ins>
<em>
value
</em>
<del class="diff-old">has
an
key
of
</del>
<ins class="diff-chg">as
</ins>
<em>
<del class="diff-old">key
</del>
<ins class="diff-chg">element
</ins>
</em>,
<del class="diff-old">replace
that
value
with
a
new
array
containing
the
existing
value
</del>
<em>
<ins class="diff-chg">property
</ins></em><ins class="diff-chg">
as
</ins><a class="tref internalDFN" title="active_property" href="#dfn-active_property"><ins class="diff-chg">
active
property
</ins></a>
and
<em>
<del class="diff-old">object
representation
</del>
<ins class="diff-chg">o
</ins></em><ins class="diff-chg">
as
</ins><em><ins class="diff-chg">
output
</ins>
</em>.
</li>
</ol>
</li>
</ol>
</li>
<li>
<del class="diff-old">Otherwise,
create
a
new
entry
in
value
with
a
key
of
</del>
<ins class="diff-chg">Set
</ins>
<em>
<del class="diff-old">key
</del>
<ins class="diff-chg">item
</ins>
</em>
<del class="diff-old">and
</del>
<ins class="diff-chg">to
</ins>
<em>
<del class="diff-old">object
representation
</del>
<ins class="diff-chg">o
</ins>
</em>.
</li>
</ol>
</li>
</ol>
</li>
<li>
<del class="diff-old">Return
</del>
<ins class="diff-chg">If
</ins>
<em>
<ins class="diff-new">output
</ins></em><ins class="diff-new">
is
an
</ins><a class="tref internalDFN" title="array" href="#dfn-array">
array
</a>,
<ins class="diff-new">append
a
copy
of
</ins><em><ins class="diff-new">
item
</ins></em>,<ins class="diff-new">
otherwise
append
a
copy
of
</ins><em><ins class="diff-new">
item
</ins>
</em>
<del class="diff-old">as
the
normalized
graph
representation.
</del>
<ins class="diff-chg">to
</ins><a class="tref internalDFN" title="active_property" href="#dfn-active_property"><ins class="diff-chg">
active
property
</ins></a><ins class="diff-chg">
in
</ins><em><ins class="diff-chg">
output
</ins></em>.
</li>
</ol>
</div>
</div>
</div>
<div id="data-round-tripping" class="section">
<h2>
<span class="secno">
<del class="diff-old">3.12
</del>
<ins class="diff-chg">4.
</ins>
</span>
Data
Round
Tripping
</h2>
<p>
When
<del class="diff-old">normalizing
</del>
<ins class="diff-chg">coercing
numbers
to
</ins><strong><ins class="diff-chg">
xsd:integer
</ins></strong><ins class="diff-chg">
or
</ins>
<strong>
xsd:double
</strong>
<del class="diff-old">values,
</del>
<ins class="diff-chg">as
it,
e.g.,
happens
during
</ins><a href="#rdf-conversion"><ins class="diff-chg">
RDF
Conversion
</ins></a>,
implementers
<em class="rfc2119" title="must">
must
</em>
ensure
that
the
<del class="diff-old">normalized
value
</del>
<ins class="diff-chg">result
</ins>
is
a
<del class="diff-old">string.
In
order
to
generate
</del>
<ins class="diff-chg">canonical
lexical
representation
in
</ins>
the
<ins class="diff-new">form
of
a
</ins><a class="tref internalDFN" title="string" href="#dfn-string">
string
</a>.
<ins class="diff-new">A
</ins><dfn title="canonical_lexical_representation" id="dfn-canonical_lexical_representation"><ins class="diff-new">
canonical
lexical
representation
</ins></dfn><ins class="diff-new">
is
a
set
of
literals
</ins>
from
<ins class="diff-new">among
the
valid
set
of
literals
for
a
datatype
such
that
there
is
a
one-to-one
mapping
between
the
canonical
lexical
representation
and
a
value
in
the
value
space
as
defined
in
[
</ins><cite><a class="bibref" rel="biblioentry" href="#bib-XMLSCHEMA-2"><ins class="diff-new">
XMLSCHEMA-2
</ins></a></cite><ins class="diff-new">
].
In
other
words,
every
value
</ins><em class="rfc2119" title="must"><ins class="diff-new">
must
</ins></em><ins class="diff-new">
be
converted
to
a
deterministic
string
representation.
</ins></p><p><ins class="diff-new">
The
canonical
lexical
representation
of
an
</ins><em><ins class="diff-new">
integer
</ins></em>,<ins class="diff-new">
i.e.,
</ins>
a
<ins class="diff-new">number
without
fractions
or
a
number
coerced
to
</ins>
<strong>
<ins class="diff-new">xsd:integer
</ins></strong>,<ins class="diff-new">
is
a
finite-length
sequence
of
decimal
digits
(
</ins><code><ins class="diff-new">
0-9
</ins></code><ins class="diff-new">
)
with
an
optional
leading
minus
sign;
leading
zeroes
are
prohibited.
To
convert
the
number
in
JavaScript,
implementers
can
use
the
following
snippet
of
code:
</ins></p><pre class="example"><ins class="diff-new">
(value).toFixed(0).toString()
</ins></pre><p><ins class="diff-new">
The
canonical
lexical
representation
of
a
</ins><em>
double
<del class="diff-old">value,
output
equivalent
</del>
</em>,
<ins class="diff-chg">i.e.,
a
number
with
fractions
or
a
number
coerced
</ins>
to
<strong>
<ins class="diff-new">xsd:double
</ins></strong>,<ins class="diff-new">
consists
of
a
mantissa
followed
by
</ins>
the
<ins class="diff-new">character
&quot;E&quot;,
followed
by
an
exponent.
The
mantissa
</ins><em class="rfc2119" title="must"><ins class="diff-new">
must
</ins></em><ins class="diff-new">
be
a
decimal
number.
The
exponent
</ins><em class="rfc2119" title="must"><ins class="diff-new">
must
</ins></em><ins class="diff-new">
be
an
integer.
Leading
zeroes
and
a
preceding
plus
sign
(
</ins>
<code>
<del class="diff-old">printf(&quot;%1.6e&quot;,
value)
</del>
<ins class="diff-chg">+
</ins>
</code>
<del class="diff-old">function
</del>
<ins class="diff-chg">)
are
prohibited
</ins>
in
<del class="diff-old">C
</del>
<ins class="diff-chg">the
exponent.
If
the
exponent
is
zero,
it
</ins>
must
be
<del class="diff-old">used
where
&quot;%1.6e&quot;
</del>
<ins class="diff-chg">indicated
by
</ins><code><ins class="diff-chg">
E0
</ins></code>.<ins class="diff-chg">
For
the
mantissa,
the
preceding
optional
plus
sign
</ins>
is
<ins class="diff-new">prohibited
and
</ins>
the
<del class="diff-old">string
formatter
</del>
<ins class="diff-chg">decimal
point
is
required.
Leading
</ins>
and
<del class="diff-old">value
</del>
<ins class="diff-chg">trailing
zeroes
are
prohibited
subject
to
the
following:
number
representations
must
be
normalized
such
that
there
is
a
single
digit
which
</ins>
is
<ins class="diff-new">non-zero
to
</ins>
the
<del class="diff-old">value
</del>
<ins class="diff-chg">left
of
the
decimal
point
and
at
least
a
single
digit
</ins>
to
<del class="diff-old">be
converted.
</del>
<ins class="diff-chg">the
right
of
the
decimal
point
unless
the
value
being
represented
is
zero.
The
canonical
representation
for
zero
is
</ins><code><ins class="diff-chg">
0.0E0
</ins></code>.
To
convert
the
<del class="diff-old">a
double
value
</del>
<ins class="diff-chg">number
</ins>
in
JavaScript,
implementers
can
use
the
following
snippet
of
code:
</p>
<del class="diff-old">// the variable 'value' below is the JavaScript native double value that is to be converted
(value).toExponential(6).replace(/(e(?:\+|-))([0-9])$/,
'$10$2')
</del>
<pre class="example">
<ins class="diff-chg">(value).toExponential().replace(/e\+?/,'E')
</ins>
</pre>
<p>
<strong>
<ins class="diff-new">xsd:double
</ins></strong><ins class="diff-new">
's
value
space
is
defined
by
the
IEEE
double-precision
64-bit
floating
point
type
[
</ins><cite><a class="bibref" rel="biblioentry" href="#bib-IEEE-754-1985"><ins class="diff-new">
IEEE-754-1985
</ins></a></cite><ins class="diff-new">
].
</ins></p>
<p class="note">
When
data
<del class="diff-old">needs
</del>
<ins class="diff-chg">such
as
decimals
need
</ins>
to
be
normalized,
JSON-LD
authors
should
not
use
values
that
are
going
to
undergo
automatic
conversion.
This
is
due
to
the
lossy
nature
of
<strong>
xsd:double
</strong>
values.
<ins class="diff-new">Authors
should
instead
use
the
expanded
object
form
to
set
the
canonical
lexical
representation
directly.
</ins></p><p class="note"><ins class="diff-new">
When
JSON-native
datatypes,
like
</ins><a class="tref internalDFN" title="number" href="#dfn-number"><ins class="diff-new">
number
</ins></a><ins class="diff-new">
s,
are
type
coerced,
lossless
data
round-tripping
can
not
be
guaranted.
Consider
the
following
code
example:
</ins></p><pre class="example">var myObj1 = {<ins class="diff-new">
               &quot;@context&quot;: {
                 &quot;number&quot;: {
                   &quot;@id&quot;: &quot;http://example.com/vocab#number&quot;,
</ins>                   <span class="diff">&quot;@type&quot;: &quot;xsd:nonNegativeInteger&quot;</span><ins class="diff-new">
                 }
               },
               &quot;number&quot; : <span class="diff">42</span>
             };
// Convert the JSON-LD document to RDF; this converts 42 to a string
var jsonldText = jsonld.toRDF(myObj1, myRdfTripleCollector);
// Convert the RDF triples back to a JavaScript object
var
myObj2
=
jsonld.fromRDF(myRdfTripleCollector.getTriples());
</ins></pre><p><ins class="diff-new">
At
this
point,
</ins><code><ins class="diff-new">
myObj1
</ins></code><ins class="diff-new">
and
</ins><code><ins class="diff-new">
myObj2
</ins></code><ins class="diff-new">
will
have
different
values
for
the
&quot;number&quot;
property.
</ins><code><ins class="diff-new">
myObj1
</ins></code><ins class="diff-new">
will
have
the
number
</ins><code><ins class="diff-new">
42
</ins></code>,<ins class="diff-new">
while
</ins><code><ins class="diff-new">
myObj2
</ins></code><ins class="diff-new">
have
an
object
consisting
of
</ins><code><ins class="diff-new">
@value
</ins></code><ins class="diff-new">
set
to
the
string
</ins><code><ins class="diff-new">
&quot;42&quot;
</ins></code><ins class="diff-new">
and
</ins><code><ins class="diff-new">
@type
</ins></code><ins class="diff-new">
set
to
the
expanded
value
of
</ins><em><ins class="diff-new">
xsd:nonNegativeInteger
</ins></em>.
</p>
<p class="note">
Some
JSON
serializers,
such
as
PHP's
native
<del class="diff-old">implementation,
backslash-escapes
</del>
<ins class="diff-chg">implementation
in
some
versions,
backslash-escape
</ins>
the
forward
slash
character.
For
example,
the
value
<code>
http://example.com/
</code>
would
be
serialized
as
<code>
http:\/\/example.com\/
<del class="diff-old">in
some
versions
of
PHP.
</del>
</code>.
This
is
problematic
<del class="diff-old">when
generating
a
byte
stream
for
processes
such
</del>
as
<del class="diff-old">normalization.
</del>
<ins class="diff-chg">other
JSON
parsers
might
not
understand
those
escaping
characters.
</ins>
There
is
no
need
to
backslash-escape
<del class="diff-old">forward-slashes
</del>
<ins class="diff-chg">forward
slashes
</ins>
in
JSON-LD.
To
aid
interoperability
between
JSON-LD
processors,
a
JSON-LD
serializer
<em class="rfc2119" title="must not">
must
not
</em>
backslash-escape
forward
slashes.
</p>
<del class="diff-old">Round-tripping
data
can
be
problematic
if
we
mix
and
match
coercion
rules
with
JSON-native
datatypes,
like
integers.
Consider
the
following
code
example:
var myObj = { &quot;@context&quot; : {
                &quot;number&quot; : {
                  &quot;@id&quot;: &quot;http://example.com/vocab#number&quot;,
                  &quot;@type&quot;: &quot;xsd:nonNegativeInteger&quot;
                }
              },
              &quot;number&quot; : 42 };
// Map the language-native object to JSON-LD
var jsonldText = jsonld.normalize(myObj);
// Convert the normalized object back to a JavaScript object
var
myObj2
=
jsonld.parse(jsonldText);
At
this
point,
myObj2
and
myObj
will
have
different
values
for
the
&quot;number&quot;
value.
myObj
will
be
the
number
42,
while
myObj2
will
be
the
string
&quot;42&quot;.
This
type
of
data
round-tripping
error
can
bite
developers.
We
are
currently
wondering
if
having
a
&quot;coercion
validation&quot;
phase
in
the
parsing/normalization
phases
would
be
a
good
idea.
It
would
prevent
data
round-tripping
issues
like
the
one
mentioned
above.
</del>
</div>
<div id="rdf-conversion" class="section">
<h2>
<span class="secno">
<del class="diff-old">3.13
</del>
<ins class="diff-chg">5.
</ins>
</span>
RDF
Conversion
</h2>
<p>
A
JSON-LD
document
<em class="rfc2119" title="may">
may
</em>
be
converted
<del class="diff-old">to
any
</del>
<ins class="diff-chg">between
</ins>
other
RDF-compatible
document
<del class="diff-old">format
</del>
<ins class="diff-chg">formats
</ins>
using
the
<del class="diff-old">algorithm
</del>
<ins class="diff-chg">algorithms
</ins>
specified
in
this
section.
</p>
<p>
The
JSON-LD
Processing
Model
describes
processing
rules
for
extracting
RDF
from
a
JSON-LD
<del class="diff-old">document.
</del>
<ins class="diff-chg">document,
and
for
transforming
an
array
of
</ins><a href="#idl-def-Statement" class="idlType"><code><ins class="diff-chg">
Statement
</ins></code></a><ins class="diff-chg">
retrieved
by
processing
another
serialization
format
into
JSON-LD.
</ins>
Note
that
many
uses
of
JSON-LD
may
not
require
generation
of
RDF.
</p>
<p>
The
processing
<del class="diff-old">algorithm
</del>
<ins class="diff-chg">algorithms
</ins>
described
in
this
section
<del class="diff-old">is
</del>
<ins class="diff-chg">are
</ins>
provided
in
order
to
demonstrate
how
one
might
implement
a
JSON-LD
to
RDF
processor.
Conformant
implementations
are
only
required
to
produce
the
same
type
and
number
of
<del class="diff-old">triples
</del>
<ins class="diff-chg">statements
</ins>
during
the
output
process
and
are
not
required
to
implement
the
algorithm
exactly
as
described.
</p>
<div class="informative section" id="overview">
<h3>
<span class="secno">
<del class="diff-old">3.13.1
</del>
<ins class="diff-chg">5.1
</ins>
</span>
Overview
</h3>
<p>
<em>
This
section
is
non-normative.
</em>
</p>
<p>
JSON-LD
is
intended
to
have
an
easy
to
parse
grammar
that
closely
models
existing
practice
in
using
JSON
for
describing
object
representations.
This
allows
the
use
of
existing
libraries
for
parsing
JSON.
</p>
<p>
As
with
other
grammars
used
for
describing
<a class="tref internalDFN" title="linked_data" href="#dfn-linked_data">
Linked
Data
</a>,
a
key
concept
is
that
of
a
<dfn title="resource" id="dfn-resource">
resource
</dfn>.
Resources
may
be
of
three
basic
types:
<del class="diff-old">IRI
</del>
<a href="#idl-def-NamedNode" class="idlType">
<code>
<ins class="diff-chg">NamedNode
</ins></code>
<del class="diff-old">s,
</del>
</a>,
<ins class="diff-chg">representing
IRIs
</ins>
for
describing
externally
named
entities,
<del class="diff-old">BNodes
,
</del>
<a href="#idl-def-BlankNode" class="idlType">
<code>
<ins class="diff-chg">BlankNode
</ins></code></a>,
resources
for
which
an
external
name
does
not
exist,
or
is
not
known,
and
<del class="diff-old">Literals,
</del>
<a href="#idl-def-LiteralNode" class="idlType">
<code>
<ins class="diff-chg">LiteralNode
</ins></code></a>,
which
describe
terminal
entities
such
as
strings,
dates
and
other
representations
having
a
lexical
representation
possibly
including
an
explicit
language
or
datatype.
</p>
<p>
An
Internationalized
Resource
Identifier
(
<dfn title="iri" id="dfn-iri">
<abbr title="Internationalized Resource Identifier">
IRI
</abbr>
</dfn>
),
as
described
in
[
<cite>
<a class="bibref" rel="biblioentry" href="#bib-RFC3987">
RFC3987
</a>
</cite>
],
is
a
mechanism
for
representing
unique
identifiers
on
the
web.
In
<a class="tref internalDFN" title="linked_data" href="#dfn-linked_data">
Linked
Data
</a>,
an
<abbr title="Internationalized Resource Identifier">
IRI
</abbr>
is
commonly
used
for
expressing
a
<a class="tref internalDFN" title="subject" href="#dfn-subject">
subject
</a>,
a
<a class="tref internalDFN" title="property" href="#dfn-property">
property
</a>
or
an
<a class="tref internalDFN" title="object" href="#dfn-object">
object
</a>.
</p>
<p>
Data
described
with
JSON-LD
may
be
considered
to
be
the
representation
of
a
graph
made
up
of
<a class="tref internalDFN" title="subject" href="#dfn-subject">
subject
</a>
and
<a class="tref internalDFN" title="object" href="#dfn-object">
object
</a>
<a class="tref internalDFN" title="resource" href="#dfn-resource">
resource
</a>
s
related
via
a
<a class="tref internalDFN" title="property" href="#dfn-property">
property
</a>
<a class="tref internalDFN" title="resource" href="#dfn-resource">
resource
</a>.
However,
specific
implementations
may
choose
to
operate
on
the
document
as
a
normal
JSON
description
of
objects
having
attributes.
</p>
</div>
<div id="rdf-conversion-algorithm-terms" class="section">
<h3>
<span class="secno">
<del class="diff-old">3.13.2
</del>
<ins class="diff-chg">5.2
</ins>
</span>
RDF
Conversion
Algorithm
Terms
</h3>
<dl>
<dt>
<del class="diff-old">default
</del>
<dfn title="graph_name" id="dfn-graph_name">
graph
<ins class="diff-new">name
</ins>
</dfn>
</dt>
<dd>
<del class="diff-old">the
destination
</del>
<ins class="diff-chg">A
</ins><a class="tref internalDFN" title="iri" href="#dfn-iri"><abbr title="Internationalized Resource Identifier"><ins class="diff-chg">
IRI
</ins></abbr></a><ins class="diff-chg">
or
</ins><a class="tref internalDFN" title="blank_node" href="#dfn-blank_node"><ins class="diff-chg">
Blank
Node
</ins></a><ins class="diff-chg">
used
to
identify
statements
belonging
to
a
</ins><em><ins class="diff-chg">
named
</ins>
graph
<del class="diff-old">for
all
triples
generated
by
JSON-LD
markup.
</del>
</em>.
</dd>
</dl>
</div>
<div id="convert-to-rdf-algorithm" class="section">
<h3>
<span class="secno">
<del class="diff-old">3.13.3
</del>
<ins class="diff-chg">5.3
</ins>
</span>
<ins class="diff-new">Convert
to
</ins>
RDF
<del class="diff-old">Conversion
</del>
Algorithm
</h3>
<p>
The
algorithm
below
is
designed
for
in-memory
implementations
with
random
access
to
<a class="tref internalDFN" title="json_object" href="#dfn-json_object">
JSON
object
</a>
elements.
</p>
<p>
A
conforming
JSON-LD
processor
implementing
RDF
conversion
<em class="rfc2119" title="must">
must
</em>
implement
a
processing
algorithm
that
results
in
the
same
<del class="diff-old">default
graph
</del>
<ins class="diff-chg">set
of
RDF
</ins><a href="#idl-def-Statement" class="idlType"><code><ins class="diff-chg">
Statement
</ins></code>
</a>
<ins class="diff-new">s
</ins>
that
the
following
algorithm
generates:
</p>
<del class="diff-old">Create
</del>
<p>
<ins class="diff-chg">The
algorithm
takes
five
input
variables:
</ins>
a
<del class="diff-old">new
processor
state
with
with
the
active
context
set
</del>
<em>
<ins class="diff-chg">element
</ins></em>
to
<del class="diff-old">the
initial
context
and
</del>
<ins class="diff-chg">be
converted,
an
</ins>
<a class="tref internalDFN" title="active_subject" href="#dfn-active_subject">
active
subject
</a>,
<a class="tref internalDFN" title="active_property" href="#dfn-active_property">
<ins class="diff-new">active
property
</ins>
</a>
and
<a class="tref internalDFN" title="graph_name" href="#dfn-graph_name">
<ins class="diff-new">graph
name
</ins></a>.<ins class="diff-new">
To
begin,
the
</ins><a class="tref internalDFN" title="active_subject" href="#dfn-active_subject"><ins class="diff-new">
active
subject
</ins></a>,
<a class="tref internalDFN" title="active_property" href="#dfn-active_property">
active
property
</a>
<del class="diff-old">initialized
</del>
<ins class="diff-chg">and
</ins><a class="tref internalDFN" title="graph_name" href="#dfn-graph_name"><ins class="diff-chg">
graph
name
</ins></a><ins class="diff-chg">
are
set
</ins>
to
<del class="diff-old">NULL.
</del>
<a class="tref internalDFN" title="null" href="#dfn-null">
<ins class="diff-chg">null
</ins></a>,<ins class="diff-chg">
and
</ins><em><ins class="diff-chg">
element
</ins></em><ins class="diff-chg">
is
set
to
the
result
of
performing
the
</ins><a href="#expansion-algorithm"><ins class="diff-chg">
Expansion
Algorithm
</ins></a><ins class="diff-chg">
on
the
</ins><a class="tref internalDFN" title="json-ld_input" href="#dfn-json-ld_input"><ins class="diff-chg">
JSON-LD
input
</ins></a>.<ins class="diff-chg">
This
removes
any
existing
context
to
allow
the
given
context
to
be
cleanly
applied.
</ins></p><ol class="algorithm">
<li id="processing-step-associative">
If
<em>
<ins class="diff-new">element
</ins></em><ins class="diff-new">
is
</ins>
a
<a class="tref internalDFN" title="json_object" href="#dfn-json_object">
JSON
object
<del class="diff-old">is
detected,
</del>
</a>,
perform
the
following
steps:
<ol class="algorithm">
<li>
<del class="diff-old">If
the
JSON
</del>
<ins class="diff-chg">Set
</ins><a class="tref internalDFN" title="active_object" href="#dfn-active_object"><ins class="diff-chg">
active
</ins>
object
</a>
<del class="diff-old">has
a
@context
key,
process
the
local
context
as
described
in
Context
.
Create
a
copy
of
the
current
JSON
object
,
changing
keys
that
map
</del>
to
<del class="diff-old">JSON-LD
keyword
s
with
those
keyword
s.
Use
the
new
JSON
object
in
subsequent
steps.
</del>
<a class="tref internalDFN" title="null" href="#dfn-null">
<ins class="diff-chg">null
</ins></a>.
</li>
<li>
If
<del class="diff-old">the
JSON
object
</del>
<em>
<ins class="diff-chg">element
</ins></em>
has
a
<code>
@value
</code>
<del class="diff-old">key,
</del>
<ins class="diff-chg">property,
</ins>
set
the
<a class="tref internalDFN" title="active_object" href="#dfn-active_object">
active
object
</a>
to
a
literal
value
as
follows:
<ol class="algorithm">
<li>
<del class="diff-old">as
</del>
<ins class="diff-chg">As
</ins>
a
<a class="tref internalDFN" title="typed_literal" href="#dfn-typed_literal">
typed
literal
</a>
if
<del class="diff-old">the
JSON
object
</del>
<em>
<ins class="diff-chg">element
</ins></em>
contains
a
<code>
@type
</code>
<del class="diff-old">key
</del>
<ins class="diff-chg">property
</ins>
after
performing
<a href="#iri-expansion">
<abbr title="Internationalized Resource Identifier">
IRI
</abbr>
Expansion
</a>
on
the
specified
<code>
@type
</code>.
</li>
<li>
<del class="diff-old">otherwise,
</del>
<ins class="diff-chg">Otherwise,
</ins>
as
a
<a class="tref internalDFN" title="plain_literal" href="#dfn-plain_literal">
plain
literal
</a>.
If
<del class="diff-old">the
JSON
object
</del>
<em>
<ins class="diff-chg">element
</ins></em>
contains
a
<code>
@language
</code>
<del class="diff-old">key,
</del>
<ins class="diff-chg">property,
</ins>
use
it's
value
to
set
the
language
of
the
plain
literal.
</li>
<del class="diff-old">If
the
neither
the
active
subject
nor
the
active
property
,
generate
a
triple
representing
the
active
subject
,
the
active
property
and
the
active
object
.
Return
the
active
object
to
the
calling
location.
</del>
</ol>
</li>
<li>
If
<del class="diff-old">the
JSON
object
</del>
<em>
<ins class="diff-chg">element
</ins></em>
has
a
<code>
@list
</code>
<del class="diff-old">key
and
</del>
<ins class="diff-chg">property
</ins>
the
value
<del class="diff-old">is
</del>
<em class="rfc2119" title="must">
<ins class="diff-chg">must
</ins></em><ins class="diff-chg">
be
</ins>
an
<a class="tref internalDFN" title="array" href="#dfn-array">
array
<del class="diff-old">process
the
</del>
</a>.
<ins class="diff-chg">Process
its
</ins>
value
as
a
list
as
described
in
<a href="#list-conversion">
List
Conversion
<del class="diff-old">.
If
</del>
</a>
<ins class="diff-chg">using
</ins>
the
<del class="diff-old">JSON
</del>
<ins class="diff-chg">return
value
as
the
</ins><a class="tref internalDFN" title="active_object" href="#dfn-active_object"><ins class="diff-chg">
active
</ins>
object
</a>
<del class="diff-old">has
a
@id
key:
</del>
</li>
<li>
If
<del class="diff-old">the
value
is
a
string
,
set
the
</del>
<a class="tref internalDFN" title="active_object" href="#dfn-active_object">
active
object
</a>
<del class="diff-old">to
the
result
of
performing
IRI
Expansion
.
Generate
</del>
<ins class="diff-chg">is
not
</ins><a class="tref internalDFN" title="null" href="#dfn-null"><ins class="diff-chg">
null
</ins></a>:<ol class="algorithm"><li><ins class="diff-chg">
If
nether
</ins><a class="tref internalDFN" title="active_subject" href="#dfn-active_subject"><ins class="diff-chg">
active
subject
</ins></a><ins class="diff-chg">
nor
</ins><a class="tref internalDFN" title="active_property" href="#dfn-active_property"><ins class="diff-chg">
active
property
</ins></a><ins class="diff-chg">
are
</ins><a class="tref internalDFN" title="null" href="#dfn-null"><ins class="diff-chg">
null
</ins></a>,<ins class="diff-chg">
generate
</ins>
a
<del class="diff-old">triple
</del>
<a href="#idl-def-Statement" class="idlType">
<code>
<ins class="diff-chg">Statement
</ins></code></a>
representing
<del class="diff-old">the
</del>
<a class="tref internalDFN" title="active_subject" href="#dfn-active_subject">
active
subject
</a>,
<del class="diff-old">the
</del>
<a class="tref internalDFN" title="active_property" href="#dfn-active_property">
active
property
<del class="diff-old">and
the
</del>
</a>,
<a class="tref internalDFN" title="active_object" href="#dfn-active_object">
active
object
</a>,
<ins class="diff-new">and
</ins><a class="tref internalDFN" title="graph_name" href="#dfn-graph_name"><ins class="diff-new">
graph
name
</ins>
</a>.
<del class="diff-old">Set
the
active
subject
to
the
</del>
</li>
<li>
<ins class="diff-chg">Return
</ins>
<a class="tref internalDFN" title="active_object" href="#dfn-active_object">
active
object
</a>.
</li>
<del class="diff-old">Create
</del>
</ol>
</li>
<li id="processing-step-subject">
<ins class="diff-chg">If
</ins><em><ins class="diff-chg">
element
</ins></em><ins class="diff-chg">
has
</ins>
a
<del class="diff-old">new
processor
state
copies
of
</del>
<code>
<ins class="diff-chg">@id
</ins></code><ins class="diff-chg">
property,
</ins>
the
<del class="diff-old">active
context
</del>
<ins class="diff-chg">value
</ins><em class="rfc2119" title="must"><ins class="diff-chg">
must
</ins></em><ins class="diff-chg">
be
a
</ins><a class="tref internalDFN" title="string" href="#dfn-string"><ins class="diff-chg">
string
</ins>
</a>,
<ins class="diff-new">set
the
</ins>
<a class="tref internalDFN" title="active_subject" href="#dfn-active_subject">
active
subject
</a>
<del class="diff-old">and
active
property
.
Process
</del>
<ins class="diff-chg">to
</ins>
the
<ins class="diff-new">previously
expanded
</ins>
value
<del class="diff-old">starting
at
Step
2
.
Proceed
using
the
previous
processor
state
.
</del>
<ins class="diff-chg">(either
a
</ins><a class="tref internalDFN" title="blank_node" href="#dfn-blank_node"><ins class="diff-chg">
blank
node
</ins></a><ins class="diff-chg">
or
an
</ins><a class="tref internalDFN" title="iri" href="#dfn-iri"><abbr title="Internationalized Resource Identifier"><ins class="diff-chg">
IRI
</ins></abbr></a><ins class="diff-chg">
).
</ins>
</li>
<li>
<del class="diff-old">If
the
JSON
object
</del>
<ins class="diff-chg">Otherwise,
if
</ins><em><ins class="diff-chg">
element
</ins></em>
does
not
have
a
<code>
@id
</code>
<del class="diff-old">key,
</del>
<ins class="diff-chg">property,
</ins>
set
the
<a class="tref internalDFN" title="active_subject" href="#dfn-active_subject">
active
<del class="diff-old">object
</del>
<ins class="diff-chg">subject
</ins>
</a>
to
newly
generated
<a class="tref internalDFN" title="blank_node" href="#dfn-blank_node">
blank
node
</a>.
<del class="diff-old">Generate
a
triple
representing
the
active
subject
,
the
active
property
and
the
active
object
.
Set
the
active
subject
to
the
active
object
.
</del>
</li>
<li>
<del class="diff-old">For
</del>
<ins class="diff-chg">Process
</ins>
each
<del class="diff-old">key
</del>
<em>
<ins class="diff-chg">property
</ins></em><ins class="diff-chg">
and
</ins><em><ins class="diff-chg">
value
</ins></em>
in
<del class="diff-old">the
JSON
object
that
has
not
already
been
processed,
perform
the
following
steps:
</del>
<em>
<ins class="diff-chg">element
</ins></em><ins class="diff-chg">
as
follows:
</ins>
<ol class="algorithm">
<li>
If
<del class="diff-old">the
key
</del>
<em>
<ins class="diff-chg">property
</ins></em>
is
<code>
@type
</code>,
set
the
<a class="tref internalDFN" title="active_property" href="#dfn-active_property">
active
property
</a>
to
<code>
rdf:type
</code>.
</li>
<li>
Otherwise,
<del class="diff-old">set
the
</del>
<ins class="diff-chg">if
</ins><em><ins class="diff-chg">
property
</ins></em><ins class="diff-chg">
is
</ins><code><ins class="diff-chg">
@graph
</ins></code>,<ins class="diff-chg">
process
</ins><em><ins class="diff-chg">
value
</ins></em><ins class="diff-chg">
algorithm
recursively,
using
</ins><a class="tref internalDFN" title="active_subject" href="#dfn-active_subject"><ins class="diff-chg">
active
subject
</ins></a><ins class="diff-chg">
as
</ins><a class="tref internalDFN" title="graph_name" href="#dfn-graph_name"><ins class="diff-chg">
graph
name
</ins></a><ins class="diff-chg">
and
null
values
for
</ins><a class="tref internalDFN" title="active_subject" href="#dfn-active_subject"><ins class="diff-chg">
active
subject
</ins></a><ins class="diff-chg">
and
</ins>
<a class="tref internalDFN" title="active_property" href="#dfn-active_property">
active
property
</a>
<ins class="diff-new">and
then
proceed
</ins>
to
<del class="diff-old">the
result
of
performing
IRI
Expansion
on
the
key.
</del>
<ins class="diff-chg">next
property.
</ins>
</li>
<li>
<del class="diff-old">If
the
active
</del>
<ins class="diff-chg">Otherwise,
if
</ins><em>
property
</em>
is
<del class="diff-old">the
target
of
</del>
a
<del class="diff-old">@list
coercion,
and
the
value
is
an
array
</del>
<a class="tref internalDFN" title="keyword" href="#dfn-keyword">
<ins class="diff-chg">keyword
</ins>
</a>,
<del class="diff-old">process
the
value
as
a
list
as
described
in
in
List
Conversion
.
</del>
<ins class="diff-chg">skip
this
step.
</ins>
</li>
<li>
Otherwise,
<del class="diff-old">create
a
new
processor
state
</del>
<ins class="diff-chg">set
</ins><a class="tref internalDFN" title="active_property" href="#dfn-active_property"><ins class="diff-chg">
active
property
</ins>
</a>
<ins class="diff-new">to
the
</ins><abbr title="Internationalized Resource Identifier"><ins class="diff-new">
IRI
</ins></abbr><ins class="diff-new">
value
of
</ins><em><ins class="diff-new">
property
</ins></em>.</li><li><ins class="diff-new">
Process
</ins><em><ins class="diff-new">
value
</ins></em><ins class="diff-new">
recursively
using
this
algorithm,
passing
</ins>
copies
of
<del class="diff-old">the
active
context
,
</del>
<a class="tref internalDFN" title="active_subject" href="#dfn-active_subject">
active
subject
<del class="diff-old">and
</del>
</a>,
<a class="tref internalDFN" title="active_property" href="#dfn-active_property">
active
property
</a>
and
<del class="diff-old">process
the
value
starting
at
Step
2
and
proceed
using
the
previous
processor
state
</del>
<a class="tref internalDFN" title="graph_name" href="#dfn-graph_name">
<ins class="diff-chg">graph
name
</ins>
</a>.
</li>
</ol>
</li>
<li>
<del class="diff-old">Return
the
</del>
<ins class="diff-chg">Set
</ins>
<a class="tref internalDFN" title="active_object" href="#dfn-active_object">
active
object
</a>
to
<del class="diff-old">the
calling
location.
</del>
<a class="tref internalDFN" title="active_subject" href="#dfn-active_subject">
<ins class="diff-chg">active
subject
</ins></a>.
</li>
</ol>
</li>
<li>
<del class="diff-old">If
a
regular
</del>
<ins class="diff-chg">Otherwise,
if
</ins><em><ins class="diff-chg">
element
</ins></em><ins class="diff-chg">
is
an
</ins>
<a class="tref internalDFN" title="array" href="#dfn-array">
array
<del class="diff-old">is
detected,
</del>
</a>,
process
each
value
in
the
<a class="tref internalDFN" title="array" href="#dfn-array">
array
</a>
<del class="diff-old">by
doing
the
following
returning
the
result
of
processing
the
last
value
in
the
array
:
Create
a
new
processor
state
</del>
<ins class="diff-chg">as
follows,
process
</ins><em><ins class="diff-chg">
element
</ins></em><ins class="diff-chg">
recursively
using
this
algorithm,
</ins>
using
copies
of
<del class="diff-old">the
active
context
,
</del>
<a class="tref internalDFN" title="active_subject" href="#dfn-active_subject">
active
subject
<del class="diff-old">and
</del>
</a>,
<a class="tref internalDFN" title="active_property" href="#dfn-active_property">
active
property
</a>,
and
<del class="diff-old">process
the
value
starting
at
Step
2
then
proceed
using
the
previous
processor
state
</del>
<a class="tref internalDFN" title="graph_name" href="#dfn-graph_name">
<ins class="diff-chg">graph
name
</ins>
</a>.
</li>
<del class="diff-old">If
a
string
is
detected:
If
the
active
property
is
the
target
of
a
@id
coercion,
set
the
active
object
by
performing
IRI
Expansion
on
the
string.
</del>
<li>
Otherwise,
if
<del class="diff-old">the
active
property
</del>
<em>
<ins class="diff-chg">element
</ins></em>
is
<del class="diff-old">the
target
of
coercion,
set
the
active
object
by
creating
</del>
a
<del class="diff-old">typed
literal
using
the
</del>
<a class="tref internalDFN" title="string" href="#dfn-string">
string
<del class="diff-old">and
the
coercion
key
as
the
datatype
IRI
.
Otherwise,
</del>
</a>,
set
the
<a class="tref internalDFN" title="active_object" href="#dfn-active_object">
active
object
</a>
to
a
<a class="tref internalDFN" title="plain_literal" href="#dfn-plain_literal">
plain
literal
</a>
value
created
from
the
string.
<del class="diff-old">If
the
active
context
contains
a
language
key
with
a
non-
null
value,
use
it's
value
to
set
the
language
of
the
plain
literal
.
</del>
</li>
<del class="diff-old">Generate
</del>
<li>
<ins class="diff-chg">Otherwise,
if
</ins><em><ins class="diff-chg">
element
</ins></em><ins class="diff-chg">
is
</ins>
a
<del class="diff-old">triple
representing
the
active
subject
</del>
<a class="tref internalDFN" title="number" href="#dfn-number">
<ins class="diff-chg">number
</ins>
</a>,
<del class="diff-old">the
active
property
and
</del>
<ins class="diff-chg">set
</ins>
the
<a class="tref internalDFN" title="active_object" href="#dfn-active_object">
active
object
<del class="diff-old">.
If
a
number
</del>
</a>
<del class="diff-old">is
detected,
generate
</del>
<ins class="diff-chg">to
</ins>
a
<a class="tref internalDFN" title="typed_literal" href="#dfn-typed_literal">
typed
literal
</a>
using
a
string
representation
of
the
value
with
datatype
set
to
either
<code>
xsd:integer
</code>
or
<code>
xsd:double
</code>,
depending
on
if
the
value
contains
a
fractional
and/or
an
exponential
component.
<del class="diff-old">Generate
a
triple
using
the
active
subject
,
active
property
and
the
generated
typed
literal.
</del>
</li>
<li>
Otherwise,
if
<em>
<ins class="diff-new">element
</ins></em><ins class="diff-new">
is
</ins>
<strong>
true
</strong>
or
<strong>
false
<del class="diff-old">is
detected,
generate
a
triple
using
</del>
</strong>,
<ins class="diff-chg">set
</ins>
the
<del class="diff-old">active
subject
,
</del>
<a class="tref internalDFN" title="active_object" href="#dfn-active_object">
active
<del class="diff-old">property
</del>
<ins class="diff-chg">object
</ins>
</a>
<del class="diff-old">and
</del>
<ins class="diff-chg">to
</ins>
a
<a class="tref internalDFN" title="typed_literal" href="#dfn-typed_literal">
typed
literal
</a>
<del class="diff-old">value
</del>
created
from
the
string
representation
of
the
value
with
datatype
set
to
<code>
xsd:boolean
</code>.
</li>
<li>
<ins class="diff-new">If
any
of
these
steps
created
an
</ins><a class="tref internalDFN" title="active_object" href="#dfn-active_object"><ins class="diff-new">
active
object
</ins></a><ins class="diff-new">
and
neither
</ins><a class="tref internalDFN" title="active_subject" href="#dfn-active_subject"><ins class="diff-new">
active
subject
</ins></a><ins class="diff-new">
nor
</ins><a class="tref internalDFN" title="active_property" href="#dfn-active_property"><ins class="diff-new">
active
property
</ins></a><ins class="diff-new">
are
</ins><a class="tref internalDFN" title="null" href="#dfn-null"><ins class="diff-new">
null
</ins></a>,<ins class="diff-new">
generate
a
</ins><a href="#idl-def-Statement" class="idlType"><code><ins class="diff-new">
Statement
</ins></code></a><ins class="diff-new">
using
</ins><a class="tref internalDFN" title="active_subject" href="#dfn-active_subject"><ins class="diff-new">
active
subject
</ins></a>,<a class="tref internalDFN" title="active_property" href="#dfn-active_property"><ins class="diff-new">
active
property
</ins></a>,<a class="tref internalDFN" title="active_object" href="#dfn-active_object"><ins class="diff-new">
active
object
</ins></a><ins class="diff-new">
and
</ins><a class="tref internalDFN" title="graph_name" href="#dfn-graph_name"><ins class="diff-new">
graph
name
</ins></a>.</li><li><ins class="diff-new">
Return
</ins><a class="tref internalDFN" title="active_object" href="#dfn-active_object"><ins class="diff-new">
active
object
</ins></a>.</li>
</ol>
</div>
<div id="list-conversion" class="section">
<h3>
<span class="secno">
<del class="diff-old">3.13.4
</del>
<ins class="diff-chg">5.4
</ins>
</span>
List
Conversion
</h3>
<p>
List
Conversion
is
the
process
of
taking
an
<a class="tref internalDFN" title="array" href="#dfn-array">
array
</a>
of
values
and
adding
them
to
a
newly
created
<cite>
<a href="http://www.w3.org/TR/rdf-schema/#ch_collectionvocab">
RDF
Collection
</a>
</cite>
(see
[
<cite>
<a class="bibref" rel="biblioentry" href="#bib-RDF-SCHEMA">
RDF-SCHEMA
</a>
</cite>
])
by
linking
each
element
of
the
list
using
<code>
rdf:first
</code>
and
<code>
rdf:next
</code>,
terminating
the
list
with
<code>
rdf:nil
</code>
using
the
following
sequence:
</p>
<p>
The
algorithm
is
invoked
with
an
<a class="tref internalDFN" title="array" href="#dfn-array">
array
</a>
<em>
array
</em>,
the
<a class="tref internalDFN" title="active_property" href="#dfn-active_property">
active
property
<del class="diff-old">,
and
the
active
context
</del>
</a>
and
returns
a
value
to
be
used
as
an
<a class="tref internalDFN" title="active_object" href="#dfn-active_object">
active
object
<del class="diff-old">.
</del>
</a>
<ins class="diff-chg">in
the
calling
location.
</ins>
</p>
<div class="note">
This
algorithm
does
not
support
lists
containing
lists.
</div>
<ol class="algorithm">
<li>
If
<em>
array
</em>
is
empty
return
<code>
rdf:nil
</code>.
</li>
<li>
Otherwise,
generate
a
<del class="diff-old">triple
</del>
<a href="#idl-def-Statement" class="idlType">
<code>
<ins class="diff-chg">Statement
</ins></code></a>
using
using
the
<a class="tref internalDFN" title="active_subject" href="#dfn-active_subject">
active
subject
</a>,
<a class="tref internalDFN" title="active_property" href="#dfn-active_property">
active
property
</a>
and
a
newly
generated
<del class="diff-old">BNode
</del>
<a class="tref internalDFN" title="blank_node" href="#dfn-blank_node">
<ins class="diff-chg">blank
node
</ins></a>
identified
as
<em>
first
<a class="tref internalDFN" title="blank_node" href="#dfn-blank_node">
blank
node
</a>
</em>.
</li>
<li>
For
each
element
in
<em>
array
</em>
other
than
the
last
element:
<ol class="algorithm">
<li>
Create
a
processor
state
using
<del class="diff-old">the
active
context
,
</del>
<em>
first
<a class="tref internalDFN" title="blank_node" href="#dfn-blank_node">
blank
node
</a>
</em>
as
the
<a class="tref internalDFN" title="active_subject" href="#dfn-active_subject">
active
subject
</a>,
and
<code>
rdf:first
</code>
as
the
<a class="tref internalDFN" title="active_property" href="#dfn-active_property">
active
property
</a>.
<ol class="algorithm">
<li>
Process
the
value
starting
at
<a href="#processing-step-associative">
Step
<del class="diff-old">2
</del>
<ins class="diff-chg">1
</ins>
</a>.
</li>
<li>
Proceed
using
the
previous
<a class="tref internalDFN" title="processor_state" href="#dfn-processor_state">
processor
state
</a>.
</li>
</ol>
</li>
<li>
Unless
this
is
the
last
element
in
<em>
array
</em>,
generate
a
new
<del class="diff-old">BNode
</del>
<a class="tref internalDFN" title="blank_node" href="#dfn-blank_node">
<ins class="diff-chg">blank
node
</ins></a>
identified
as
<em>
rest
<a class="tref internalDFN" title="blank_node" href="#dfn-blank_node">
blank
node
</a>
</em>,
otherwise
use
<code>
rdf:nil
</code>.
</li>
<li>
Generate
a
new
<del class="diff-old">triple
</del>
<a href="#idl-def-Statement" class="idlType">
<code>
<ins class="diff-chg">Statement
</ins></code></a>
using
<em>
first
<a class="tref internalDFN" title="blank_node" href="#dfn-blank_node">
blank
node
</a>
</em>,
<code>
rdf:rest
</code>
and
<em>
rest
<a class="tref internalDFN" title="blank_node" href="#dfn-blank_node">
blank
node
</a>
</em>.
</li>
<li>
Set
<em>
first
<a class="tref internalDFN" title="blank_node" href="#dfn-blank_node">
blank
node
</a>
</em>
to
<em>
rest
<a class="tref internalDFN" title="blank_node" href="#dfn-blank_node">
blank
node
</a>
</em>.
</li>
<li>
Return
<em>
first
<a class="tref internalDFN" title="blank_node" href="#dfn-blank_node">
blank
node
</a>
</em>.
</li>
</ol>
</li>
</ol>
</div>
<div id="convert-from-rdf-algorithm" class="section">
<h3>
<span class="secno">
<ins class="diff-new">5.5
</ins></span><ins class="diff-new">
Convert
from
RDF
Algorithm
</ins></h3><p><ins class="diff-new">
In
some
cases,
data
exists
natively
in
Triples
or
Quads
form;
for
example,
if
the
data
was
originally
represented
in
an
RDF
graph
or
triple/quad
store.
This
algorithm
is
designed
to
simply
translate
an
array
of
</ins><a href="#idl-def-Statement" class="idlType"><code><ins class="diff-new">
Statement
</ins></code></a><ins class="diff-new">
s
into
a
JSON-LD
document.
</ins></p><p><ins class="diff-new">
The
conversion
algorithm
takes
a
single
parameter
</ins><em><ins class="diff-new">
input
</ins></em><ins class="diff-new">
in
the
form
of
an
array
of
</ins><a href="#idl-def-Statement" class="idlType"><code><ins class="diff-new">
Statement
</ins></code></a><ins class="diff-new">
representations.
</ins></p><ol class="algorithm"><li><ins class="diff-new">
Construct
a
JSON
</ins><a class="tref internalDFN" title="array" href="#dfn-array"><ins class="diff-new">
array
</ins></a><em><ins class="diff-new">
array
</ins></em><ins class="diff-new">
to
serve
as
the
output
object.
</ins></li><li><ins class="diff-new">
Construct
a
</ins><a class="tref internalDFN" title="json_object" href="#dfn-json_object"><ins class="diff-new">
JSON
object
</ins></a><em><ins class="diff-new">
listMap
</ins></em><ins class="diff-new">
to
map
graph
names
and
subjects
to
objects
derived
from
statements
having
a
property
of
</ins><code><ins class="diff-new">
rdf:first
</ins></code>.</li><li><ins class="diff-new">
Construct
a
</ins><a class="tref internalDFN" title="json_object" href="#dfn-json_object"><ins class="diff-new">
JSON
object
</ins></a><em><ins class="diff-new">
restMap
</ins></em><ins class="diff-new">
to
map
graph
names
and
subjects
to
objects
derived
from
statements
having
a
property
of
</ins><code><ins class="diff-new">
rdf:rest
</ins></code>.</li><li><ins class="diff-new">
Construct
a
</ins><a class="tref internalDFN" title="json_object" href="#dfn-json_object"><ins class="diff-new">
JSON
object
</ins></a><em><ins class="diff-new">
subjectMap
</ins></em><ins class="diff-new">
to
map
graph
names
and
subjects
to
</ins><a class="tref internalDFN" title="json_object" href="#dfn-json_object"><ins class="diff-new">
JSON
object
</ins></a><ins class="diff-new">
instances
contained
in
</ins><em><ins class="diff-new">
array
</ins></em>.</li><li><ins class="diff-new">
For
each
statement
in
</ins><em><ins class="diff-new">
input
</ins></em>:<ol class="algorithm"><li><ins class="diff-new">
If
</ins><em><ins class="diff-new">
property
</ins></em><ins class="diff-new">
is
</ins><code><ins class="diff-new">
rdf:first
</ins></code>,<ins class="diff-new">
create
a
new
entry
in
</ins><em><ins class="diff-new">
listMap
</ins></em><ins class="diff-new">
with
for
</ins><em><ins class="diff-new">
name
</ins></em><ins class="diff-new">
and
</ins><em><ins class="diff-new">
subject
</ins></em><ins class="diff-new">
and
an
array
value
containing
</ins><em><ins class="diff-new">
object
</ins></em><ins class="diff-new">
representation
and
skip
to
the
next
statement.
</ins></li><li><ins class="diff-new">
If
</ins><em><ins class="diff-new">
property
</ins></em><ins class="diff-new">
is
</ins><code><ins class="diff-new">
rdf:rest
</ins></code>,<ins class="diff-new">
and
</ins><em><ins class="diff-new">
object
</ins></em><ins class="diff-new">
is
a
</ins><a href="#idl-def-BlankNode" class="idlType"><code><ins class="diff-new">
BlankNode
</ins></code></a>,<ins class="diff-new">
create
a
new
entry
in
</ins><em><ins class="diff-new">
restMap
</ins></em><ins class="diff-new">
to
map
</ins><em><ins class="diff-new">
name
</ins></em><ins class="diff-new">
and
</ins><em><ins class="diff-new">
subject
</ins></em><ins class="diff-new">
to
a
value
being
the
result
of
</ins><a href="#iri-expansion"><abbr title="Internationalized Resource Identifier"><ins class="diff-new">
IRI
</ins></abbr><ins class="diff-new">
expansion
</ins></a><ins class="diff-new">
on
</ins><em><ins class="diff-new">
object
</ins></em><ins class="diff-new">
and
skip
to
the
next
statement.
</ins></li><li><ins class="diff-new">
If
</ins><em><ins class="diff-new">
name
</ins></em><ins class="diff-new">
is
not
</ins><a class="tref internalDFN" title="null" href="#dfn-null"><ins class="diff-new">
null
</ins></a>:<ol class="algorithm"><li><ins class="diff-new">
If
</ins><em><ins class="diff-new">
subjectMap
</ins></em><ins class="diff-new">
does
not
have
an
entry
for
</ins><a class="tref internalDFN" title="null" href="#dfn-null"><ins class="diff-new">
null
</ins></a><ins class="diff-new">
as
name
and
</ins><em><ins class="diff-new">
name
</ins></em><ins class="diff-new">
as
subject:
</ins><ol class="algorithm"><li><ins class="diff-new">
Create
a
new
</ins><a class="tref internalDFN" title="json_object" href="#dfn-json_object"><ins class="diff-new">
JSON
object
</ins></a><ins class="diff-new">
with
key/value
pair
of
</ins><code><ins class="diff-new">
@id
</ins></code><ins class="diff-new">
and
a
string
representation
of
</ins><em><ins class="diff-new">
name
</ins></em><ins class="diff-new">
and
use
as
</ins><em><ins class="diff-new">
value
</ins></em>.</li><li><ins class="diff-new">
Save
</ins><em><ins class="diff-new">
value
</ins></em><ins class="diff-new">
in
</ins><em><ins class="diff-new">
subjectMap
</ins></em><ins class="diff-new">
and
append
to
</ins><em><ins class="diff-new">
array
</ins></em>.</li></ol></li><li><ins class="diff-new">
Otherwise,
use
that
entry
as
</ins><em><ins class="diff-new">
value
</ins></em>.</li><li><ins class="diff-new">
If
</ins><em><ins class="diff-new">
value
</ins></em><ins class="diff-new">
does
not
have
an
entry
for
</ins><code><ins class="diff-new">
@graph
</ins></code>,<ins class="diff-new">
initialize
it
as
a
new
</ins><a class="tref internalDFN" title="array" href="#dfn-array"><ins class="diff-new">
array
</ins></a><em><ins class="diff-new">
ary
</ins></em>.</li><li><ins class="diff-new">
Otherwise,
let
</ins><em><ins class="diff-new">
ary
</ins></em><ins class="diff-new">
be
that
array.
</ins></li><li><ins class="diff-new">
If
</ins><em><ins class="diff-new">
subjectMap
</ins></em><ins class="diff-new">
does
not
have
an
entry
for
</ins><code><ins class="diff-new">
name
</ins></code><ins class="diff-new">
and
</ins><em><ins class="diff-new">
subject
</ins></em>:<ol class="algorithm"><li><ins class="diff-new">
Create
a
new
</ins><a class="tref internalDFN" title="json_object" href="#dfn-json_object"><ins class="diff-new">
JSON
object
</ins></a><ins class="diff-new">
with
key/value
pair
of
</ins><code><ins class="diff-new">
@id
</ins></code><ins class="diff-new">
and
a
string
representation
of
</ins><em><ins class="diff-new">
subject
</ins></em><ins class="diff-new">
and
use
as
</ins><em><ins class="diff-new">
value
</ins></em>.</li><li><ins class="diff-new">
Save
</ins><em><ins class="diff-new">
value
</ins></em><ins class="diff-new">
in
</ins><em><ins class="diff-new">
subjectMap
</ins></em><ins class="diff-new">
and
append
to
</ins><em><ins class="diff-new">
ary
</ins></em>.</li></ol></li><li><ins class="diff-new">
Otherwise,
use
that
entry
as
</ins><em><ins class="diff-new">
value
</ins></em>.</li></ol></li><li><ins class="diff-new">
Otherwise,
if
</ins><em><ins class="diff-new">
subjectMap
</ins></em><ins class="diff-new">
does
not
have
an
entry
for
</ins><a class="tref internalDFN" title="null" href="#dfn-null"><ins class="diff-new">
null
</ins></a><ins class="diff-new">
as
name
and
</ins><em><ins class="diff-new">
subject
</ins></em>:<ol class="algorithm"><li><ins class="diff-new">
Create
a
new
</ins><a class="tref internalDFN" title="json_object" href="#dfn-json_object"><ins class="diff-new">
JSON
object
</ins></a><ins class="diff-new">
with
key/value
pair
of
</ins><code><ins class="diff-new">
@id
</ins></code><ins class="diff-new">
and
a
string
representation
of
</ins><em><ins class="diff-new">
subject
</ins></em><ins class="diff-new">
and
use
as
</ins><em><ins class="diff-new">
value
</ins></em>.</li><li><ins class="diff-new">
Save
</ins><em><ins class="diff-new">
value
</ins></em><ins class="diff-new">
in
</ins><em><ins class="diff-new">
subjectMap
</ins></em><ins class="diff-new">
and
append
to
</ins><em><ins class="diff-new">
array
</ins></em>.</li></ol></li><li><ins class="diff-new">
Otherwise,
use
that
entry
as
</ins><em><ins class="diff-new">
value
</ins></em>.</li><li><ins class="diff-new">
If
</ins><em><ins class="diff-new">
property
</ins></em><ins class="diff-new">
is
</ins><code><ins class="diff-new">
rdf:type
</ins></code>:<ol class="algorithm"><li><ins class="diff-new">
Append
the
string
representation
of
</ins><em><ins class="diff-new">
object
</ins></em><ins class="diff-new">
to
the
array
value
for
the
key
</ins><code><ins class="diff-new">
@type
</ins></code>,<ins class="diff-new">
creating
an
entry
in
</ins><em><ins class="diff-new">
value
</ins></em><ins class="diff-new">
if
necessary.
</ins></li></ol></li><li><ins class="diff-new">
Otherwise,
if
</ins><em><ins class="diff-new">
object
</ins></em><ins class="diff-new">
is
</ins><code><ins class="diff-new">
rdf:nil
</ins></code>:<ol class="algorithm"><li><ins class="diff-new">
Let
</ins><em><ins class="diff-new">
key
</ins></em><ins class="diff-new">
be
the
string
representation
of
</ins><em><ins class="diff-new">
property
</ins></em>.</li><li><ins class="diff-new">
Set
the
value
for
</ins><em><ins class="diff-new">
key
</ins></em><ins class="diff-new">
in
</ins><em><ins class="diff-new">
value
</ins></em><ins class="diff-new">
to
an
empty
</ins><code><ins class="diff-new">
@list
</ins></code><ins class="diff-new">
representation:
</ins><code><ins class="diff-new">
{&quot;@list&quot;:
[]}
</ins></code>.</li></ol></li><li><ins class="diff-new">
Otherwise,
</ins><ol class="algorithm"><li><ins class="diff-new">
Let
</ins><em><ins class="diff-new">
key
</ins></em><ins class="diff-new">
be
the
string
representation
of
</ins><em><ins class="diff-new">
property
</ins></em><ins class="diff-new">
and
let
</ins><em><ins class="diff-new">
object
representation
</ins></em><ins class="diff-new">
be
</ins><em><ins class="diff-new">
object
</ins></em><ins class="diff-new">
represented
in
expanded
form
as
described
in
</ins><a href="#value-expansion"><ins class="diff-new">
Value
Expansion
</ins></a>.</li><li><ins class="diff-new">
Append
</ins><em><ins class="diff-new">
object
representation
</ins></em><ins class="diff-new">
to
the
array
value
for
</ins><em><ins class="diff-new">
key
</ins></em>,<ins class="diff-new">
creating
an
entry
in
</ins><em><ins class="diff-new">
value
</ins></em><ins class="diff-new">
if
necessary.
</ins></li></ol></li></ol></li><li><ins class="diff-new">
For
each
</ins><em><ins class="diff-new">
name
</ins></em>,<em><ins class="diff-new">
map
</ins></em><ins class="diff-new">
in
</ins><em><ins class="diff-new">
restMap
</ins></em>:<ol class="algorithm"><li><ins class="diff-new">
For
each
key/value
</ins><em><ins class="diff-new">
prev
</ins></em>,<em><ins class="diff-new">
rest
</ins></em><ins class="diff-new">
entry
in
</ins><em><ins class="diff-new">
map
</ins></em>,<ins class="diff-new">
append
to
the
</ins><em><ins class="diff-new">
listMap
</ins></em><ins class="diff-new">
value
identified
by
</ins><em><ins class="diff-new">
name
</ins></em><ins class="diff-new">
and
</ins><em><ins class="diff-new">
prev
</ins></em><ins class="diff-new">
the
</ins><em><ins class="diff-new">
listMap
</ins></em><ins class="diff-new">
value
identified
by
</ins><em><ins class="diff-new">
name
</ins></em><ins class="diff-new">
and
</ins><em><ins class="diff-new">
rest
</ins></em>.</li></ol></li><li><ins class="diff-new">
For
each
</ins><em><ins class="diff-new">
name
</ins></em>,<em><ins class="diff-new">
map
</ins></em><ins class="diff-new">
in
</ins><em><ins class="diff-new">
listMap
</ins></em>:<ol class="algorithm"><li><ins class="diff-new">
For
each
key/value
</ins><em><ins class="diff-new">
node
</ins></em>,<em><ins class="diff-new">
list
</ins></em>,<ins class="diff-new">
in
</ins><em><ins class="diff-new">
map
</ins></em><ins class="diff-new">
where
</ins><em><ins class="diff-new">
list
</ins></em><ins class="diff-new">
exists
as
a
value
of
an
object
in
</ins><em><ins class="diff-new">
array
</ins></em>,<ins class="diff-new">
replace
the
object
value
with
</ins><em><ins class="diff-new">
list
</ins></em>.</li></ol></li><li><ins class="diff-new">
Return
array
as
the
graph
representation
in
expanded
form.
</ins></li></ol></div>
</div>
<div class="appendix informative section" id="iana-considerations">
<h2>
<span class="secno">
<ins class="diff-new">A.
</ins></span><ins class="diff-new">
IANA
Considerations
</ins></h2><p><em><ins class="diff-new">
This
section
is
non-normative.
</ins></em></p><p><ins class="diff-new">
This
section
is
included
merely
for
standards
community
review
and
will
be
submitted
to
the
Internet
Engineering
Steering
Group
if
this
specification
becomes
a
W3C
Recommendation.
</ins></p><dl><dt><ins class="diff-new">
Type
name:
</ins></dt><dd><ins class="diff-new">
application
</ins></dd><dt><ins class="diff-new">
Subtype
name:
</ins></dt><dd><ins class="diff-new">
ld-frame+json
</ins></dd><dt><ins class="diff-new">
Required
parameters:
</ins></dt><dd><ins class="diff-new">
None
</ins></dd><dt><ins class="diff-new">
Optional
parameters:
</ins></dt><dd><ins class="diff-new">
None
</ins></dd><dt><ins class="diff-new">
Encoding
considerations:
</ins></dt><dd><ins class="diff-new">
The
same
as
the
</ins><code><ins class="diff-new">
application/json
</ins></code><ins class="diff-new">
MIME
media
type.
</ins></dd><dt><ins class="diff-new">
Security
considerations:
</ins></dt><dd><ins class="diff-new">
Since
a
JSON-LD
frame
is
intended
to
specify
a
deterministic
layout
for
a
JSON-LD
graph,
the
serialization
</ins><em class="rfc2119" title="should not"><ins class="diff-new">
should
not
</ins></em><ins class="diff-new">
be
passed
through
a
code
execution
mechanism
such
as
JavaScript's
</ins><code><ins class="diff-new">
eval()
</ins></code><ins class="diff-new">
function.
It
is
</ins><em class="rfc2119" title="recommended"><ins class="diff-new">
recommended
</ins></em><ins class="diff-new">
that
a
conforming
parser
does
not
attempt
to
directly
evaluate
the
JSON-LD
frame
and
instead
purely
parse
the
input
into
a
language-native
data
structure.
</ins></dd><dt><ins class="diff-new">
Interoperability
considerations:
</ins></dt><dd><ins class="diff-new">
Not
Applicable
</ins></dd><dt><ins class="diff-new">
Published
specification:
</ins></dt><dd><ins class="diff-new">
The
</ins><a href="http://json-ld.org/spec/latest/"><ins class="diff-new">
JSON-LD
</ins></a><ins class="diff-new">
specification.
</ins></dd><dt><ins class="diff-new">
Applications
that
use
this
media
type:
</ins></dt><dd><ins class="diff-new">
Any
programming
environment
that
requires
the
exchange
of
directed
graphs.
Implementations
of
JSON-LD
have
been
created
for
JavaScript,
Python,
Ruby,
PHP
and
C++.
</ins></dd><dt><ins class="diff-new">
Additional
information:
</ins></dt><dd><dl><dt><ins class="diff-new">
Magic
number(s):
</ins></dt><dd><ins class="diff-new">
Not
Applicable
</ins></dd><dt><ins class="diff-new">
File
extension(s):
</ins></dt><dd>.jsonldf</dd><dt><ins class="diff-new">
Macintosh
file
type
code(s):
</ins></dt><dd><ins class="diff-new">
TEXT
</ins></dd></dl></dd><dt><ins class="diff-new">
Person
&amp;
email
address
to
contact
for
further
information:
</ins></dt><dd><ins class="diff-new">
Manu
Sporny
&lt;msporny@digitalbazaar.com&gt;
</ins></dd><dt><ins class="diff-new">
Intended
usage:
</ins></dt><dd><ins class="diff-new">
Common
</ins></dd><dt><ins class="diff-new">
Restrictions
on
usage:
</ins></dt><dd><ins class="diff-new">
None
</ins></dd><dt><ins class="diff-new">
Author(s):
</ins></dt><dd><ins class="diff-new">
Manu
Sporny,
Gregg
Kellogg,
Markus
Lanthaler,
Dave
Longley
</ins></dd><dt><ins class="diff-new">
Change
controller:
</ins></dt><dd><ins class="diff-new">
W3C
</ins></dd></dl></div><div id="appendix-b" class="appendix section"><h2><span class="secno"><ins class="diff-new">
B.
</ins></span><ins class="diff-new">
Initial
Context
</ins></h2><p><ins class="diff-new">
The
</ins><a class="tref internalDFN" title="initial_context" href="#dfn-initial_context"><ins class="diff-new">
initial
context
</ins></a><ins class="diff-new">
is
defined
with
the
following
default
entries:
</ins></p><pre class="example">{<ins class="diff-new">
  &quot;@context&quot;: {
    &quot;http://www.w3.org/1999/02/22-rdf-syntax-ns#type&quot;: { &quot;@type&quot;: &quot;@id&quot;}
  }
}
</ins></pre><p><ins class="diff-new">
Processors
</ins><em class="rfc2119" title="must"><ins class="diff-new">
must
</ins></em><ins class="diff-new">
act
as
if
the
initial
context
is
defined
in
the
outer-most
level
when
processing
JSON-LD
documents.
</ins></p><p class="issue"><ins class="diff-new">
Should
we
define
other
default
prefixes?
</ins></p>
</div>
<div class="appendix section" id="acknowledgements">
<h2>
<span class="secno">
<del class="diff-old">A.
</del>
<ins class="diff-chg">C.
</ins>
</span>
Acknowledgements
</h2>
<p>
The
editors
would
like
to
thank
Mark
Birbeck,
who
provided
a
great
deal
of
the
initial
push
behind
the
JSON-LD
work
via
his
work
on
RDFj,
Dave
Lehn
and
Mike
Johnson
who
reviewed,
provided
feedback,
and
performed
several
implementations
of
the
specification,
and
Ian
Davis,
who
created
RDF/JSON.
Thanks
also
to
Nathan
Rixham,
Bradley
P.
Allen,
Kingsley
Idehen,
Glenn
McDonald,
Alexandre
Passant,
Danny
Ayers,
Ted
Thibodeau
Jr.,
Olivier
Grisel,
Niklas
Lindström,
Markus
Lanthaler,
and
Richard
Cyganiak
for
their
input
on
the
specification.
</p>
</div>
<del class="diff-old">B.
Initial
Context
The
initial
context
is
defined
with
the
following
default
entries:
{
  &quot;@context&quot;: {
    &quot;http://www.w3.org/1999/02/22-rdf-syntax-ns#type&quot;: { &quot;@type&quot;: &quot;@id&quot;}
  }
}
Processors
must
act
as
if
the
initial
context
is
defined
in
the
outer-most
level
when
processing
JSON-LD
documents.
Should
we
define
other
default
prefixes?
</del>
<div id="references" class="appendix section">
<h2>
<span class="secno">
<del class="diff-old">C.
</del>
<ins class="diff-chg">D.
</ins>
</span>
References
</h2>
<div id="normative-references" class="section">
<h3>
<span class="secno">
<del class="diff-old">C.1
</del>
<ins class="diff-chg">D.1
</ins>
</span>
Normative
references
</h3>
<dl class="bibliography">
<dt id="bib-BCP47">
<ins class="diff-new">[BCP47]
</ins></dt><dd><ins class="diff-new">
A.
Phillips,
M.
Davis.
</ins><a href="http://tools.ietf.org/rfc/bcp/bcp47.txt"><cite><ins class="diff-new">
Tags
for
Identifying
Languages
</ins></cite></a><ins class="diff-new">
September
2009.
IETF
Best
Current
Practice.
URL:
</ins><a href="http://tools.ietf.org/rfc/bcp/bcp47.txt"><ins class="diff-new">
http://tools.ietf.org/rfc/bcp/bcp47.txt
</ins></a></dd><dt id="bib-IEEE-754-1985"><ins class="diff-new">
[IEEE-754-1985]
</ins></dt><dd><ins class="diff-new">
IEEE.
</ins><cite><ins class="diff-new">
IEEE
Standard
for
Binary
Floating-Point
Arithmetic.
</ins></cite><ins class="diff-new">
See
</ins><a href="http://standards.ieee.org/reading/ieee/std_public/description/busarch/754-1985_desc.html"><ins class="diff-new">
http://standards.ieee.org/reading/ieee/std_public/description/busarch/754-1985_desc.html
</ins></a></dd><dt id="bib-IRI"><ins class="diff-new">
[IRI]
</ins></dt><dd><ins class="diff-new">
M.
Duerst,
M.
Suignard.
</ins><a href="http://www.ietf.org/rfc/rfc3987.txt"><cite><ins class="diff-new">
Internationalized
Resource
Identifiers
(IRI).
</ins></cite></a><ins class="diff-new">
January
2005.
Internet
RFC
3987.
URL:
</ins><a href="http://www.ietf.org/rfc/rfc3986.txt"><ins class="diff-new">
http://www.ietf.org/rfc/rfc3987.txt
</ins></a></dd>
<dt id="bib-JSON-LD">
[JSON-LD]
</dt>
<dd>
Manu
Sporny,
Gregg
<del class="diff-old">Kellogg.
</del>
<ins class="diff-chg">Kellogg,
Markus
Lanthaler.
</ins>
<a href="http://json-ld.org/spec/latest/json-ld-syntax/">
<cite>
The
JSON-LD
Syntax
</cite>
</a>
Latest.
W3C
Editor's
Draft.
URL:
<a href="http://json-ld.org/spec/latest/json-ld-syntax/">
http://json-ld.org/spec/latest/json-ld-syntax/
</a>
</dd>
<dt id="bib-JSON-POINTER">
[JSON-POINTER]
</dt>
<dd>
P.
Bryan,
Ed.
<cite>
<a href="http://www.ietf.org/id/draft-pbryan-zyp-json-pointer-01.txt">
JSON
Pointer
</a>
</cite>
Latest.
IETF
Draft.
URL:
<a href="http://www.ietf.org/id/draft-pbryan-zyp-json-pointer-01.txt">
http://www.ietf.org/id/draft-pbryan-zyp-json-pointer-01.txt
</a>
</dd>
<dt id="bib-RDF-CONCEPTS">
[RDF-CONCEPTS]
</dt>
<dd>
Graham
Klyne;
Jeremy
J.
Carroll.
<a href="http://www.w3.org/TR/2004/REC-rdf-concepts-20040210">
<cite>
Resource
Description
Framework
(RDF):
Concepts
and
Abstract
Syntax.
</cite>
</a>
10
February
2004.
W3C
Recommendation.
URL:
<del class="diff-old">&lt;a href="http://w
</del>
<a href="http://www.w3.org/TR/2004/REC-rdf-concepts-20040210">
<ins class="diff-chg">http://www.w3.org/TR/2004/REC-rdf-concepts-20040210
</ins></a></dd><dt id="bib-RDF-SCHEMA"><ins class="diff-chg">
[RDF-SCHEMA]
</ins></dt><dd><ins class="diff-chg">
Dan
Brickley;
Ramanathan
V.
Guha.
</ins><a href="http://www.w3.org/TR/2004/REC-rdf-schema-20040210"><cite><ins class="diff-chg">
RDF
Vocabulary
Description
Language
1.0:
RDF
Schema.
</ins></cite></a><ins class="diff-chg">
10
February
2004.
W3C
Recommendation.
URL:
</ins><a href="http://www.w3.org/TR/2004/REC-rdf-schema-20040210"><ins class="diff-chg">
http://www.w3.org/TR/2004/REC-rdf-schema-20040210
</ins></a></dd><dt id="bib-RFC3986"><ins class="diff-chg">
[RFC3986]
</ins></dt><dd><ins class="diff-chg">
T.
Berners-Lee;
R.
Fielding;
L.
Masinter.
</ins><a href="http://www.ietf.org/rfc/rfc3986.txt"><cite><ins class="diff-chg">
Uniform
Resource
Identifier
(URI):
Generic
Syntax.
</ins></cite></a><ins class="diff-chg">
January
2005.
Internet
RFC
3986.
URL:
</ins><a href="http://www.ietf.org/rfc/rfc3986.txt"><ins class="diff-chg">
http://www.ietf.org/rfc/rfc3986.txt
</ins></a></dd><dt id="bib-RFC3987"><ins class="diff-chg">
[RFC3987]
</ins></dt><dd><ins class="diff-chg">
M.
Dürst;
M.
Suignard.
</ins><a href="http://www.ietf.org/rfc/rfc3987.txt"><cite><ins class="diff-chg">
Internationalized
Resource
Identifiers
(IRIs).
</ins></cite></a><ins class="diff-chg">
January
2005.
Internet
RFC
3987.
URL:
</ins><a href="http://www.ietf.org/rfc/rfc3987.txt"><ins class="diff-chg">
http://www.ietf.org/rfc/rfc3987.txt
</ins></a></dd><dt id="bib-RFC4627"><ins class="diff-chg">
[RFC4627]
</ins></dt><dd><ins class="diff-chg">
D.
Crockford.
</ins><a href="http://www.ietf.org/rfc/rfc4627.txt"><cite><ins class="diff-chg">
The
application/json
Media
Type
for
JavaScript
Object
Notation
(JSON)
</ins></cite></a><ins class="diff-chg">
July
2006.
Internet
RFC
4627.
URL:
</ins><a href="http://www.ietf.org/rfc/rfc4627.txt"><ins class="diff-chg">
http://www.ietf.org/rfc/rfc4627.txt
</ins></a></dd><dt id="bib-WEBIDL"><ins class="diff-chg">
[WEBIDL]
</ins></dt><dd><ins class="diff-chg">
Cameron
McCormack.
</ins><a href="http://www.w3.org/TR/2011/WD-WebIDL-20110927/"><cite><ins class="diff-chg">
Web
IDL.
</ins></cite></a><ins class="diff-chg">
27
September
2011.
W3C
Working
Draft.
(Work
in
progress.)
URL:
</ins><a href="http://www.w3.org/TR/2011/WD-WebIDL-20110927/"><ins class="diff-chg">
http://www.w3.org/TR/2011/WD-WebIDL-20110927/
</ins></a></dd><dt id="bib-XMLSCHEMA-2"><ins class="diff-chg">
[XMLSCHEMA-2]
</ins></dt><dd><ins class="diff-chg">
Paul
V.
Biron;
Ashok
Malhotra.
</ins><a href="http://www.w3.org/TR/2004/REC-xmlschema-2-20041028/"><cite><ins class="diff-chg">
XML
Schema
Part
2:
Datatypes
Second
Edition.
</ins></cite></a><ins class="diff-chg">
28
October
2004.
W3C
Recommendation.
URL:
</ins><a href="http://www.w3.org/TR/2004/REC-xmlschema-2-20041028/"><ins class="diff-chg">
http://www.w3.org/TR/2004/REC-xmlschema-2-20041028/
</ins></a></dd></dl></div><div id="informative-references" class="section"><h3><span class="secno"><ins class="diff-chg">
D.2
</ins></span><ins class="diff-chg">
Informative
references
</ins></h3><dl class="bibliography"><dt id="bib-ECMA-262"><ins class="diff-chg">
[ECMA-262]
</ins></dt><dd><a href="http://www.ecma-international.org/publications/standards/Ecma-262.htm"><cite><ins class="diff-chg">
ECMAScript
Language
Specification.
</ins></cite></a><ins class="diff-chg">
December
1999.
URL:
</ins><a href="http://www.ecma-international.org/publications/standards/Ecma-262.htm"><ins class="diff-chg">
http://www.ecma-international.org/publications/standards/Ecma-262.htm
</ins></a></dd><dt id="bib-MICRODATA"><ins class="diff-chg">
[MICRODATA]
</ins></dt><dd><ins class="diff-chg">
Ian
Hickson;
et
al.
</ins><a href="http://www.w3.org/TR/microdata/"><cite><ins class="diff-chg">
Microdata
</ins></cite></a><ins class="diff-chg">
04
March
2010.
W3C
Working
Draft.
URL:
</ins><a href="http://www.w3.org/TR/microdata/"><ins class="diff-chg">
http://www.w3.org/TR/microdata/
</ins></a></dd><dt id="bib-MICROFORMATS"><ins class="diff-chg">
[MICROFORMATS]
</ins></dt><dd><a href="http://microformats.org"><cite><ins class="diff-chg">
Microformats
</ins></cite></a>.<ins class="diff-chg">
URL:
</ins><a href="http://microformats.org"><ins class="diff-chg">
http://microformats.org
</ins></a></dd><dt id="bib-RDFA-CORE"><ins class="diff-chg">
[RDFA-CORE]
</ins></dt><dd><ins class="diff-chg">
Shane
McCarron;
et
al.
</ins><a href="http://www.w3.org/TR/2012/CR-rdfa-core-20120313/"><cite><ins class="diff-chg">
RDFa
Core
1.1:
Syntax
and
processing
rules
for
embedding
RDF
through
attributes.
</ins></cite></a><ins class="diff-chg">
13
March
2012.
W3C
Candidate
Recommendation.
URL:
</ins><a href="http://www.w3.org/TR/2012/CR-rdfa-core-20120313/"><ins class="diff-chg">
http://www.w3.org/TR/2012/CR-rdfa-core-20120313/
</ins>

